Search code examples
androidmakefileandroid-sourceramandroid-7.0-nougat

Building AOSP with only 8 GB RAM


I encounted the following trouble when building the AOSP 7.

[ 45% 16221/35670] Building with Jack:...k_intermediates/with-local/classes.dex
FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex.rsp
Out of memory error (version 1.2-rc4 'Carnac' (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by [email protected])).
GC overhead limit exceeded.
Try increasing heap size with java option '-Xmx'.
Warning: This may have produced partial or corrupted output.
[ 45% 16221/35670] Building with Jack:...colorpicker_intermediates/classes.jack
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
#### make failed to build some targets (01:26:54 (hh:mm:ss)) ####

Is this because AOSP became bigger in capacity?

I have never faced such trouble when I tried to build AOSP 6 or lower versions.

Please help.


Solution

  • You need to edit .jack-settings, and add this line

    JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"
    

    Hope this solves your problem.