构建android源时超出GC开销限制

时间:2016-01-02 02:07:37

标签: java android-source android-build

****[ 35% 11837/33004] build out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack 
FAILED:/bin/bash -c
"
(mkdir -p out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/)
&& (java -Xmx3500m -jar out/host/linux-x86/framework/jill.jar --output out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack.tmpjill.jack prebuilts/sdk/21/android.jar)
&& (mkdir -p out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack.tmpjill.res)
&& (unzip -qo prebuilts/sdk/21/android.jar -d out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack.tmpjill.res)
&& (find out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack.tmpjill.res -iname \"*.class\" -delete)
&& (JACK_VERSION=2.26.RELEASE out/host/linux-x86/bin/jack @build/core/jack-default.args --verbose error -D jack.import.resource.policy=keep-first -D jack.import.type.policy=keep-first --import out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack.tmpjill.jack --import-resource out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack.tmpjill.res --output-jack out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack)
&& (rm -rf out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack.tmpjill.res)
&& (rm out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack.tmpjill.jack)
" GC overhead limit exceeded Try increasing heap size with java option '-Xmx' Warning: This may have produced partial or corrupted output. [ 35% 11837/33004] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex.rsp Communication error with Jack server (52) ninja: build stopped: subcommand failed. build/core/ninja.mk:139: recipe for target 'ninja_wrapper' failed make: *** [ninja_wrapper] Error 1****

这是构建过程停止的错误消息,它表示尝试使用java选项" -Xmx"来增加堆大小,但我不知道在构建android源时如何配置它。 / p>

2 个答案:

答案 0 :(得分:5)

看起来像Android makefile中的一个错误 - 3500兆字节真的不足以在Android中构建一些Java包。它是硬编码的值,您可以在build/core/config.mk中找到它。现在你可以简单地在本地增加它(但是它不是放在某个环境变量中是很奇怪的。)

我已将它增加到5500兆字节,它就像一个魅力。

答案 1 :(得分:0)

谷歌建议至少16GB的内存用于构建源代码,我们已经体验过Android N确实是强制性的。

除非为机器提供16 GB的RAM,否则源代码构建的可靠性确实很低。您可以尝试插孔服务器和参数的多种配置,但它们都不能证明是可靠的。

这是许多人面临的类似问题: https://code.google.com/p/android/issues/detail?id=194027

我希望这有帮助!