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

yuiopt
  • 127
  • 1
  • 1
  • 9

2 Answers2

5

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.

  • Thanks for help , I found out the **-Xmx** option in `config.mk`, but there are no more memories to be used, Maybe I should increase the machine's memory. – yuiopt Jan 03 '16 at 07:47
  • 1
    @yuiopt yeah, highly parallel build is quite memory-heavy - you can increase swap and/or decrease the number of build threads. – Grigoriy Dzhanelidze Jan 03 '16 at 14:46
  • Hello, I run into this issue and I found this page from the docs : https://source.android.com/source/jack.html#jack_troubleshooting . Also, I do not found the xmx command in the config.mk file, only this line : APICHECK_COMMAND := $(APICHECK) -JXmx1024m -J"classpath $(APICHECK_CLASSPATH)" Is this the line you are referring to ? – Poutrathor May 04 '16 at 14:54
  • See http://stackoverflow.com/questions/35579646/android-source-code-compile-error-try-increasing-heap-size-with-java-option for more recent (in android 6.0) ways to fix this) – icyerasor May 29 '16 at 15:46
  • @icyerasor Thank you very mych,it is very helpful. – yuiopt Aug 13 '16 at 07:16
0

Google recommends minimum 16GB of RAM for building source code and we have experienced that with Android N it is indeed mandatory.

Unless 16 GB of RAM is given to machine, reliability of source code build is really really low. You may try multiple configurations of jack-server and parameters but none of them may prove to be a reliable.

This is running thread of similar problems faced by many :- https://code.google.com/p/android/issues/detail?id=194027

I hope this helps !

DPKGRG
  • 65
  • 1
  • 5