android源码编译相关
1 在ubuntu中编译android6.0时需要openjdk7, 但是openjdk-7-jdk 和openjdk-7-jre需要同时安装。
创新互联-专业网站定制、快速模板网站建设、高性价比舒城网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式舒城网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖舒城地区。费用合理售后完善,10余年实体公司更值得信赖。
$sudo apt-get install openjdk-7-jre
$sudo apt-get install openjdk-7-jdk
PS: openjdk-7-jre包只包含Java运行时环境(Java Runtime Environment)。如果是要开发Java应用程
序,则需要安装openjdk-7-jdk包。
2 在ubuntu中更新jdk链接
Installing Oracle JDK 8 on Ubuntu:
Extract the tar file:
tar -xvzf jdk-8-linux-x64.tar.gz
Create jvm folder in /usr/lib, if jvm folder not exist
sudo mkdir /usr/lib/jvm
Move extracted jdk 8 folder to this location:
sudo mv jdk1.8.0 /usr/lib/jvm/jdk1.8.0
Install new java source in system:
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0/bin/javac 1 sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0/bin/java 1 sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.8.0/bin/javaws 1
Choose default java:
sudo update-alternatives --config javac sudo update-alternatives --config java sudo update-alternatives --config javaws
Java version test:
java -version
参考链接 http://www.devsniper.com/install-jdk-8-on-ubuntu/
3 android N 编译
1)编译错误
Java heap spaceTry increasing heap size with java option '-Xmx'Warning: This may have produced partial or corrupted output.ninja: build stopped: subcommand failed.build/core/ninja.mk:146: recipe for target 'ninja_wrapper' failed make: *** [ninja_wrapper] Error 1
解决方案: 在文件 out/host/linux-x86/bin/jack-admin 添加 值
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation " 然后重启 out/host/linux-x86/bin/jack-admin kill-server out/host/linux-x86/bin/jack-admin start-server 5 编译andorid orea,内存不够: 解决方案: The problem is that virtual machine which runs jack doesn't have enough memory. You can try to edit jvm command:JACK_VM_COMMAND=${JACK_VM_COMMAND:="java -Xmx4096m"} or to decrease number of parallel jack compilationsSERVER_NB_COMPILE=2 in file. You can read jack documentation for details.EDIT: Changing .jack file didn't work for me. After digging a little deeper I found that jack server is started with out/host/linux-x86/bin/jack-admin script and it's parameters can be passed with JACK_SERVER_VM_ARGUMENTS environment variable.So my solution was to set it and restart jack server before building aosp :
6在android8orea, cts中添加第三方jar包:LOCAL_STATIC_JAVA_LIBRARIES :=poi(在compatibility-host-util andorid.mk 文件中)
make cts时,出现错误:
ninja: error: '/media/camille/android_src/out/androidOrea/host/common/obj/JAVA_LIBRARIES/poi_intermediates/classes.jar', needed by '/media/camille/android_src/out/androidOrea/host/common/obj/JAVA_LIBRARIES/compatibility-host-util_intermediates/classes-full-debug.jar', missing and no known rule to make it
15:00:20 ninja failed with: exit status 1
build/core/main.mk:21: recipe for target 'run_soong_ui' failed
make: *** [run_soong_ui] Error 1
说明编译package compatibility-host-util 需要poi_intermediates下的文件classes.jar。
解决方法: 复制一份poi_intermediates下的文件javalib.jar, rename to classes.jar。再次编译,就可以了。
分享文章:android源码编译相关
本文地址:http://ybzwz.com/article/jpgeps.html