flpymonkey
flpymonkey

Reputation: 46

Failure to launch Android Studio; Failed to create JVM: error code -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.

Upvotes: 1

Views: 2818

Answers (3)

Anita
Anita

Reputation: 35

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

Upvotes: 0

Vừng Nhỏ
Vừng Nhỏ

Reputation: 69

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 :(

Upvotes: 3

flpymonkey
flpymonkey

Reputation: 46

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.

Upvotes: 2

Related Questions