Skip to content

Latest commit

 

History

History
54 lines (45 loc) · 2.36 KB

tips-and-workarounds-android-readme.md

File metadata and controls

54 lines (45 loc) · 2.36 KB

#Android tips and workarounds This document covers tips, tricks, and known workarounds for problems with the Cordova Android platform.

Note: If your problem is security related, please read May 26th, 2015 Android Security Issue

##Could Not Create Java Virtual Machine Error When building for Android, you may encounter a set of errors in the Errors List like the following:

Error		Could not create the Java Virtual Machine.			
Error		A fatal exception has occurred. Program will exit.									
Error		C:\cordova\BlankCordovaApp2\BlankCordovaApp2\platforms\android\cordova\build.bat: Command failed with exit code 1

The problem is that the Ant or Gradle build systems are running out of heap memory when you try to compile your app. To resolve this problem, you can increase the heap of the JVM by setting the following environment variable and restarting Visual Studio:

_JAVA_OPTIONS=-Xmx512M

More specifically, following the instructions from this article:

  1. Close Visual Studio, if you do not close it - you will need to restart it at the end.
  2. Open the Control Panel.
  3. Go to System and Security.
  4. Go to System.
  5. Go to Advanced systems settings.
  6. Go to Environment Variables... (on the Advanced tab).
  7. Under System Variables, click New
  8. Variable Name: _JAVA_OPTIONS.
  9. Variable Value: -Xmx512M.
  10. Click OK to close the dialog.
  11. Click OK to close Environment Variables.
  12. Click OK to close System Properties.
  13. Now open Visual Studio.

If this does not resolve the issue, you can upgrade to a 64-bit version of the JDK from here and update the JAVA_HOME environment variable to the new install location.

More Information