搭建Android编译环境比较简单,主要分以下3部,对于我这种64bit的机器来说,搭建过程需要特别小心。 搭建前,需要sudo apt-get update一次。 1.安装JAVA环境 我选择的是jdk-6u33-linux-x64.bin,在/opt目录下解压得到jdk1.6.0_33,并配置/etc/profile文件: export JAVA_HOME=/opt/jdk1.6.0_33 export CLASS_PATH=${JAVA_HOME}/lib export PATH=${PATH}{JAVA_HOME}/bin 配置完毕后,重启系统才可生效。
指定sunjava为默认java编辑工具链:
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.6.0_33/bin/javac 100 sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-6-openjdk-amd64/bin/javac 50 sudo update-alternatives --install /usr/bin/javaws javaws /opt/jdk1.6.0_33/jre/bin/javaws 100 sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/javaws 50 sudo update-alternatives --install /usr/bin/java java /opt/jdk1.6.0_33/jre/bin/java 100 sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 50 sudo update-alternatives --install /usr/bin/javadoc javadoc /opt/jdk1.6.0_33/bin/javadoc 100 sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/java-6-openjdk-amd64/bin/javadoc 50 sudo update-alternatives --install /usr/bin/javah javah /opt/jdk1.6.0_33/bin/javah 100 sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/java-6-openjdk-amd64/bin/javah 50 sudo update-alternatives --install /usr/bin/javap javap /opt/jdk1.6.0_33/bin/javap 100 sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/java-6-openjdk-amd64/bin/javap 50 2.安装相关的编译软件:
sudo apt-get install gcc-4.4 g++-4.4 gcc-4.4-multilib g++-4.4-multilib \ git-core gnupg flex bison gperf build-essential \ zip curl libc6-dev libncurses5-dev:i386 libncurses5-dev x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \ libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386 3.将gnu4.4工具指定为默认编译工具 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 100 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 100 sudo update-alternatives --install /usr/bin/cpp cpp-bin /usr/bin/cpp-4.4 100 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 50 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 50 sudo update-alternatives --install /usr/bin/cpp cpp-bin /usr/bin/cpp-4.6 50
|