Ravindra Pawar
Ravindra Pawar

Reputation: 477

failed to create jvm error code 4 android studio

I was just updated my last Android Studio and got this error:

failed to create jvm error code -4 JVM Path: C:\Program Files\Java\jdk1.7.0_45\jre If you already have a 32-bit JDK installed, define a JAVA_HOME variable in Which is not solved.

Upvotes: 23

Views: 29621

Answers (8)

Vyacheslav  Doroshenko
Vyacheslav Doroshenko

Reputation: 404

For Android Studio 4+ You need to remove «\studio.exe.vmoptions» or «studio64.exe.vmoptions» Here is the path

C:\Users\%USERNAME%\AppData\Roaming\Google\{studio version} 

Upvotes: 10

wizsab
wizsab

Reputation: 55

Go to

C:\Program Files\Android\Android Studio\bin\studio64.exe.vmoptions

Delete studio64.exe.vmoptions file

That's what worked for me

Upvotes: 0

UmAnusorn
UmAnusorn

Reputation: 11124

I have rechecked the java path but its not working in my case. So I deleted the Android Studio settings folder in my user folder.

C:\Users\my_username.AndroidStudio

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

In some case is in C:/Users/my_username/.AndroidStudio3.0/studio64.vmoptions.

Upvotes: 23

Majid
Majid

Reputation: 14253

If you have recently modified Custom VM Options using Help menu, then you should undo your changes or if you have created a new VM options file, remove it. The file can be found on this path:

C:\Users\.AndroidStudio2.1

Upvotes: 7

Brandon Thompson
Brandon Thompson

Reputation: 125

All I had to do was run android studio as an administrator. Just right click on the icon on your desktop (do not try to do it with a shortcut pinned to your taskbar) and click run as administrator.

Upvotes: 1

Ravindra Pawar
Ravindra Pawar

Reputation: 477

finally I got answer here. You need to change vmoptions file from android studio.

Go to Program files > Android > Android Studio > Bin > android studio.exe vmoptions file.

Open it with notepad and change the following attributes :

Change -Xmx512m to -Xmx256m and -XX:MaxPermSize=250m to -XX:MaxPermSize=128m or

Change -Xmx750m to -Xmx512m and -XX:MaxPermSize=350m to -XX:MaxPermSize=250m

Upvotes: 8

Akhil Katam
Akhil Katam

Reputation: 29

just updating my JDK worked for me! :D If it still doesn't work, try updating Android Studio.

Upvotes: 2

Bhavan Patel
Bhavan Patel

Reputation: 1755

Go to C:\Program Files\Android\Android Studio\bin\studio.exe.vmoptions

Open it with notepad. some times it will not be editable so give administrative permission and change the following attributes:

-Xmx512m to -Xmx256m

-XX:MaxPermSize=250m to -XX:MaxPermSize=128m

Or change:

-Xmx750m to -Xmx512m

-XX:MaxPermSize=350m to -XX:MaxPermSize=250m

Upvotes: 55

Related Questions