Run android errors

So, I’m simply trying to run my app on a plugged in HTC Desire. The steps I’ve taken are: enabling debugging in the manifest xml, enabled usb debugging on the device itself, and created the AVD with a custom definition in the android AVD manager.

The errors I’m getting after running ionic run android --info

“Could not create the Java Virtual Machine”
“Could not reserve enough space for object heap”, as well as the warning
“No target specified, deploying device [random device number that i have no clue where it’s coming from]”

Here’s an image of my command window:

Any ideas why i might have this warning and error messages? Are they related issues? or are they two seperate issues?

Thanks in advance! :slight_smile:

The warning is harmless. To fix the error increase the amount of memory for the JVM. See:

https://code.google.com/p/android/issues/detail?id=75060#c11

I got the same error trying to run the build for the “getting started” example.

To fix, I created the file gradle.properties in the user home (C:\Users\username\.gradle or ~\.gradle) and set the jvm options:

org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=256m

Note: For Windows, 1024m is maybe too much. I had to set to 512m (even having 8GB of total memory).

4 Likes

Yes, that worked. thanks!

1 Like

Oh yes!.. Bravoo… I was almost uninstalling everything and giving up ionic! This solved my problem and gave me strength to kick going. :wink:
Merci, beaucoup! :smile:

worked for me too! thanks. not sure why this error started happening all of the sudden. i’ve been building with ‘ionic run android’ for months now and this just started erroring. anyways, thanks!

I was having the same problem and i added org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=256m to my gradle.properties . But now i’m having a different problem .
> Error occurred during initialization of VM

 Could not reserve enough space for 2097152KB object heap

If you are using windows then follow this:

Go to Start → Control Panel → System → Advanced system settings → advanced(tab) → Environment Variables → System Variables → New:

Variable name:_ JAVA_OPTIONS (there is no space between _ and JAVA_OPTIONS, but the editor is not letting me do so… :frowning: )
Variable value: -Xmx512M

I hope this will solve problem, :slight_smile:

2 Likes

Thanks, issue solved

Thanks @bharat_mungarh, this solved my problem perfectly!