Out of memory error when creating Android in a virtual machine

So, I'm trying to create Android. I select the device for lunch, clean it, and then run make updatepackage with various -j switches.

However, the assembly will fail:

FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex.rsp
Out of memory error (version 1.2-a24 'Carnac' (283001 7e39a352cafc1eb3b4ae95846a101b93ccbc9cf0)).
Java heap space.
Try increasing heap size with java option '-Xmx<size>'.
Warning: This may have produced partial or corrupted output.
[ 42% 11683/27285] build out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack
ninja: build stopped: subcommand failed.
build/core/ninja.mk:144: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

The OS I use is Ubuntu 15.10 on a 4-core virtual machine. I tried to add additional swap memory (currently it is 8 GB and 24 GB as a swap), choosing different -j values ​​(from 4 to 10) and exceeding the GC upper limit when creating the source for Android , changing the value -Xmx.

As for the latter, there is only one reference to -Xmx:

APICHECK_COMMAND := $(APICHECK) -JXmx1024m -J"classpath $(APICHECK_CLASSPATH)"

However, changing it to more than 1024 m for something else, nothing will change.

So what can I do to create it?

+4

All Articles