Android: Could not reserve enough space for object heap

April 15th, 2011 by Christian Leave a reply »

If you ever get an error like
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

or
BUILD FAILED
...ant_rules_r3.xml:361: The following error occurred while executing this line:
...ant_rules_r3.xml:174: apply returned: 1
,
don’t let yourself get fooled about some threads found on google.

The answer why your VM crashes is, that the heap space trying to be allocated is not free in physical memory.

That means: try to decrease the setting for max heap space in the file android-sdk-windows/platform-toolsdx.bat to smaller value. I had to change it to 512M instead of 1024M, meaning:
set defaultMx=-Xmx512M

And tada, off you go!

Leave a Reply