Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GC overhead limit exceeded when building android source

****[ 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****

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.

like image 739
yuiopt Avatar asked Jan 02 '16 02:01

yuiopt


People also ask

How do I fix GC overhead limit exceeded in eclipse?

From the root of the Eclipse folder open the eclipse. ini and change the default maximum heap size of -Xmx256m to -Xmx1024m on the last line. NOTE: If there is a lot of memory available on the machine, you can also try using -Xmx2048m as the maximum heap size.

What is GC overhead limit?

GC Overhead Limit Exceeded Error It's thrown by the JVM when it encounters a problem related to utilizing resources. More specifically, the error occurs when the JVM spent too much time performing Garbage Collection and was only able to reclaim very little heap space.

How do you fix memory limit exceeded in Java?

Memory Limit Exceeded Error: It typically occurs when no memory limit has been set. It means that the program is trying to allocate more memory than the memory limit for the particular problem. For Example, if the memory limit is 256 MB, then there is no need to write code that requires more than 256 MB of memory.


1 Answers

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).

I've increased it to 5500 megabytes and it works like a charm.

like image 54
Grigoriy Dzhanelidze Avatar answered Sep 29 '22 07:09

Grigoriy Dzhanelidze