简体   繁体   中英

Android Studio failed to create JVM: error code -1

I recently installed Android Studio and initially it worked but then (after finding it very sluggish) I edited the studio64.exe.vmoptions and now it gives an error:

Failed to create JVM: error code -1. JVM Path: C:\\Program Files\\Android\\Android Studio\\jre\\jre If you already have a 64-bit JDK installed, define a JAVA_HOME variable in Computer>System Properties>System Settings>Environment Variables

I have already set JAVA_HOME variable as C:\\Program Files\\Java\\jdk-9 (I previously had version 8 but thought I'd try a different version see what happened as did not work anyway so nothing to lose).

I have since uninstalled Android Studio and tried to get back to a blank slate but the error remains. My studio64.exe.vmoptions file is as follows:

#
# *DO NOT* modify this file directly. If there is a value that you would 
like to override,
# please add it to your user specific configuration file.
#
# See http://tools.android.com/tech-docs/configuration
#
-Xms256m
-Xmx1280m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-da
-Djna.nosys=true
-Djna.boot.library.path=

-Djna.debug_load=true
-Djna.debug_load.jna=true
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Didea.paths.selector=AndroidStudio2.3
-Didea.platform.prefix=AndroidStudio
-Didea.jre.check=true

I have tried to find an original copy of this file to check against but with no luck so far. If anyone can see where I am going wrong would be greatly appreciate. Have tried any other fixes I can find on here.

Had the same problem, this was my solution:

  1. go to C:\\Users\\ username \\.androidStudio\\ (your path might be a bit different, but make sure to go the local version of Android Studio, not the general version (that lives in the Program Files directory)),

    1. find the studio.exe.vmoptions (or studio64.exe.vmoptions) file and delete it. try to open Android Studio again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM