1.jdk 8安装
# apt install openjdk-8-jre-headless
# apt install openjdk-8-jdk-headless
测试:# java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11)
2.安装依赖包
ubuntu18.04 编译android所需要的依赖包不是很多
# apt install g++-multilib
# apt install gperf
# apt install libxml2-utils
# apt install curl
3.编译android7.1.2
问题1:error:flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' Failed.
Aborted (core dumped)
fix::在编译脚本中增加export LC_ALL=C
问题2:Out of memory error (version 1.2-rc4 'Carnac' (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by android-jack-team@google.com)).
GC overhead limit exceeded.
Try increasing heap size with java option '-Xmx<size>'.
fix:修改源码目录下prebuilts/sdk/tools/jack-admin文件的JACK_SERVER_VM_ARGUMENTS变量,添加-Xmx4096M(这个根据你自己的情况),接着make clean,make -j4重新构建
问题3:错误:prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/EXECUTABLES/libaapt2_tests_intermediates/split/TableSplitter_test.o: file is empty
fix: ln -s /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/x86_64-linux/bin/ld
问题4:Communication error with Jack server (52). Try 'jack-diagnose'
fix:
#out/host/linux-x86/bin/jack-admin kill-server
#out/host/linux-x86/bin/jack-admin start-server