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
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.
just updating my JDK worked for me! :D If it still doesn't work, try updating Android Studio.
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.
Go to
C:\Program Files\Android\Android Studio\bin\studio64.exe.vmoptions
Delete studio64.exe.vmoptions file
That's what worked for me
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
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}