1

When trying to launch Android Studio on Windows I get the following error:

Failed to create JVM: error code -1 JVM Path: C:\Program Files\Java\jdk1.8.0_91\jre

I have tried setting the JAVA_PATH variable and I have also tried uninstalling Android Studio and Java and then reinstalling. I came to this error while trying to mess with the path variables to use an external Java library.

Any suggestions on fixing this problem?

EDIT: The solution I gave below seems to work for error code -1 and -4 in my case. The only issue is that you lose your user settings if you use the solution given.

flpymonkey
  • 46
  • 1
  • 6

3 Answers3

3

With: Failed to create JVM: error code -1

I tried deleting the studio64.exe.vmoptions file

(from: C:\Users\vungnho.AndroidStudio3.1\config)

(vungnho - my user name; .AndroidStudio3.1 - config folder for current Studio)

and it worked!


Exactly, I tried reinstall Android Studio but the problem still occur,

so I tried rename .AndroidStudio3.1 folder, but it have many my configs :(

2

Problem solved! This thread was extremely helpful:

failed to create jvm error code 4 android studio

What ended up working for me was deleting the Android Studio setting folder in my user folder.

C:\Users\my_username.AndroidStudio

Then re-open Android Studio then everything work fine for me.

Community
  • 1
  • 1
flpymonkey
  • 46
  • 1
  • 6
  • This is the only thing that helped me. Of note is that I had to reinstall Android studio after doing this, but at least it let me continue after doing that (where before, it did not). – John Leehey Aug 18 '17 at 23:35
0

For those that are using the Android studio version 4, can find the .vmoptions in the following path: C:\Users\YourUserName\AppData\Roaming\Google\AndroidStudio4.1

as mentioned here in the official documentation of Android: https://developer.android.com/studio/intro/studio-config

Anita
  • 15
  • 5