搭建Android編譯環境比較簡單,主要分如下3部,對於我這種64bit的機器來講,搭建過程須要特別當心。java
搭建前,須要sudo apt-get update一次。python
1.安裝JAVA環境linux
我選擇的是jdk-6u33-linux-x64.bin,在/opt目錄下解壓獲得jdk1.6.0_33,並配置/etc/profile文件:git
export JAVA_HOME=/opt/jdk1.6.0_33markdown
export CLASS_PATH=${JAVA_HOME}/libcurl
export PATH=${PATH}:${JAVA_HOME}/binjvm
配置完畢後,重啓系統纔可生效。
工具
指定sunjava爲默認java編輯工具鏈:
flex
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.6.0_33/bin/javac 100ui
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
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