Ubuntu 16.04 LTS 成功编译 Android 6.0 源码教程
sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386 \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib \
tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 \
dpkg-dev libsdl1.2-dev libesd0-dev \
git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib \
libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev \
lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip m4 \
u-boot-tools \
uuid-dev
#安装jdk7
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-7-jdk
#配置jdk7
sudo gedit /etc/profile
#在末尾追加下面代码:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
修改了/etc/profile文件需要重启才能生效,但使用下面命令可以在不重启的情况下在当前bash环境生效:
source /etc/profile
检查OpenJDK配置是否正确:
java -version
错误现象及解决:
shell脚本中source aaa.sh时提示 source: not found
原因: ls -l which sh 提示/bin/sh -> dash
这说明是用dash来进行解析的。
改回方法:
命令行执行:sudo dpkg-reconfigure dash
在界面中选择no
再ls -l which sh 提示/bin/sh -> bash
修改成功,source可以用了~
cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
make update-api
#开始编译 ./build.sh -a