3
votes

I downloaded the latest version of Android Studio, but I can not use it. The following message appears:

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 Computer > System Properties > System Settings > Environment Variables.

But I've set the JAVA_HOME to

C:\Program Files\Java\jdk1.7.0_45

Added to the end of the Path:

;C:\Program Files\Java\jdk1.7.0_45\bin

javaDebug

java version "1.7.0_45"

Java(TM) SE Runtime Environment (build 1.7.0_45-b18)

Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)

What is wrong?

2
This is Best answer and solv. stackoverflow.com/a/33094171/4923424Mohamed Elsawy

2 Answers

6
votes

You need to edit your vmoptions file (in my case it was in C:\Program Files\Android\android-studio\bin\studio.exe.vmoptions), open it with a text editor and reduce the values of -Xmx and -XX:PermSize (change -Xmx512m to -Xmx256m and -XX:MaxPermSize=250m to -XX:MaxPermSize=128m). Save it and restart the IDE.

0
votes

****Worked solution for me*****

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 https://stackoverflow.com/a/42858136/4111151