• Register
1 vote


I am getting this error when I tried to build shadow demo for android:

Building DEX Failed!
G:\Unity\JavaPluginSample\Temp/StagingArea> java -Xmx1024M
-jar "G:/AndroidSDK/android-sdk_r09-windows\platform-tools/lib/dx.jar"
--dex --verbose --output=bin/classes.dex bin/classes.jar plugins
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

Can anybody help to fix or explain me this error

6.1k points

Please log in or register to answer this question.

1 Answer

2 votes


This is usually caused by a bad version of Java being installed on your machine.
Try updating your Java install to the latest version and this will generally solve this issue.

or you can try it :

Go to Start->Control Panel->System->Advanced(tab)->Environment Variables->System Variables->New:
Variable name: _JAVA_OPTIONS
Variable value: -Xmx512M
Variable name: Path
Variable value: ;C:\Program Files\Java\jre6\bin;F:\JDK\bin;
Change this to your appropriate path.


35k points