java 构建android源时超出GC开销限制
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34561925/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
GC overhead limit exceeded when building android source
提问by yuiopt
****[ 35% 11837/33004] build out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.Hyman
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.Hyman.tmpjill.Hyman prebuilts/sdk/21/android.jar)
&& (mkdir -p out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.Hyman.tmpjill.res)
&& (unzip -qo prebuilts/sdk/21/android.jar -d out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.Hyman.tmpjill.res)
&& (find out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.Hyman.tmpjill.res -iname \"*.class\" -delete)
&& (Hyman_VERSION=2.26.RELEASE out/host/linux-x86/bin/Hyman @build/core/Hyman-default.args --verbose error -D Hyman.import.resource.policy=keep-first -D Hyman.import.type.policy=keep-first --import out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.Hyman.tmpjill.Hyman --import-resource out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.Hyman.tmpjill.res --output-Hyman out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.Hyman)
&& (rm -rf out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.Hyman.tmpjill.res)
&& (rm out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.Hyman.tmpjill.Hyman)
" 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 Hyman: 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 Hyman server (52) ninja: build stopped: subcommand failed. build/core/ninja.mk:139: recipe for target 'ninja_wrapper' failed make: *** [ninja_wrapper] Error 1****
This is the error message where the building process stopped, it says try to increase heap size with java option "-Xmx",but I do not know how to config it when building the android source.
这是构建过程停止的错误消息,它说尝试使用 java 选项“-Xmx”增加堆大小,但我不知道在构建 android 源代码时如何配置它。
采纳答案by Grigoriy Dzhanelidze
Seems like a bug in Android makefiles - 3500 megabytes is really not enough to build some Java packages inside Android. It's hardcoded value, you can find it in build/core/config.mk. For now you can simply increase it locally (however it's weird that it isn't placed in some environment variable).
似乎是 Android 生成文件中的一个错误 - 3500 兆字节确实不足以在 Android 中构建一些 Java 包。它是硬编码值,您可以在build/core/config.mk 中找到它。现在你可以简单地在本地增加它(但是它没有放在某个环境变量中很奇怪)。
I've increased it to 5500 megabytes and it works like a charm.
我已经将它增加到 5500 兆字节,它的作用就像一个魅力。
回答by DPKGRG
Google recommends minimum 16GB of RAM for building source code and we have experienced that with Android N it is indeed mandatory.
Google 建议至少 16GB 的 RAM 用于构建源代码,我们已经体验过 Android N 确实是强制性的。
Unless 16 GB of RAM is given to machine, reliability of source code build is really really low. You may try multiple configurations of Hyman-server and parameters but none of them may prove to be a reliable.
除非给机器提供 16 GB 的 RAM,否则源代码构建的可靠性真的很低。您可以尝试 Hyman-server 和参数的多种配置,但没有一个可能被证明是可靠的。
This is running thread of similar problems faced by many :- https://code.google.com/p/android/issues/detail?id=194027
这是许多人面临的类似问题的运行线程:- https://code.google.com/p/android/issues/detail?id=194027
I hope this helps !
我希望这有帮助 !