android7.0 源码编译问题总结

转载:https://blog.csdn.net/ronnyjiang/article/details/55812305

常见问题:

1.USER问题(由于运行的docker 容易没有配置USER环境变量)

      JACK VMCOMMAND="java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation -jar out/host/linux-x86/framework/jack-launcher.jar " JACK_JAR="out/host/linux-x86/framework/jack.jar" out/host/linux-x86/bin/jack-admin start-server out/host/linux-x86/bin/jack-admin: line 27: USER: unbound variable

      这是由于docker没有设置USER环境变量导致,手动添加后继续编译即可

[html]  view plain  copy
  1. export USER=$(whoami)  


    也可以在docker构建文件Dockerfile中加上如下语句:

[html]  view plain  copy
  1. ENV USER root   /////或者自己需要的名字  


2.Building with Jack: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex

FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex.rsp
GC overhead limit exceeded
Try increasing heap size with java option '-Xmx<size>'
Warning: This may have produced partial or corrupted output.
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1

#### make failed to build some targets (14:09 (mm:ss)) ####

Same problem here.I tried setting JACK_SERVER_VM_ARGUMENTS to include -Xmx=4g, but when building again the log output showed that this was not included in the startup. Dunno why, seems like the env vars do not get passed to the build script correctly.

Solution: before starting a clean android build set the JACK_SERVER_VM_ARGUMENTS to include -Xmx=4g, then stop and start the jack servermanually. Given you're in the main source tree of AOSP run the following:

扫描二维码关注公众号,回复: 49778 查看本文章

[html]  view plain  copy
  1. export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"  
  2. ./prebuilts/sdk/tools/jack-admin kill-server  
  3. ./prebuilts/sdk/tools/jack-admin start-server  

for cm you can use 

[html]  view plain  copy
  1. export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"  
  2. jack-admin kill-server && jack-admin start-server  

3.  如果编译的时候说jdk版本不对,要求1.8的就安装1.8的。而android7.0 要求的是OPNJDK1.8 不是oracle-jdk1.8.  如果是oracle的jdk1.8也没关系,只需要修改build/core/main.mk把里面的   requires_openjdk := false即可

[html]  view plain  copy
  1. # Check for the current JDK.  
  2. #  
  3. # For Java 1.7/1.8, we require OpenJDK on linux and Oracle JDK on Mac OS.  
  4. requires_openjdk :false  
  5. ifeq ($(BUILD_OS),linux)  
  6. requires_openjdk :false  
  7. endif  

猜你喜欢

转载自blog.csdn.net/fen_liu/article/details/80052788