Android Studio failed to load JVM on Mac OSX (Mavericks)

后端 未结 6 1249
南笙
南笙 2021-01-30 17:28

I am trying to setup Android Studio on my Mac. It is running OSX 10.9.1 Mavericks. I have installed the latest JDK (at the time of writing 1.7 update 45), and I installed Androi

相关标签:
6条回答
  • 2021-01-30 17:52

    As answered by hasternet @ Android Studio was unable to find a valid Jvm (Related to MAC OS) For quick and dirty solution, Follow the answer by Mgamerz; open Android Studio in Finder (CTRL+Click > Show Package Contests > Contents > info.plist) and edit Key JVMOptions>JVMVersion from "1.6*" to "1.6+"

    Recommended method as discovered by Antonio Jose is to edit environment variables in MacOS (messing with info.plist is not recommended) either at program launch (opening the Studio through terminal rather than the icon)

    $ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
    $ open /Applications/Android\ Studio.app
    

    or setting up the environment through AppleScript at every MacOS startup:

    do shell script "launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk"
    
    do shell script "launchctl setenv STUDIO_PROPERTIES /Users/username/Library/Preferences/AndroidStudio/idea.properties"
    
    do shell script "launchctl setenv STUDIO_VM_OPTIONS /Users/username/Library/Preferences/AndroidStudio/studio.vmoptions"
    

    (Remember to save the script as Application. Antonio Jose managed with just the first line - AFAIK you can use .properties and .vmoptions to set up additional settings.)

    Official instructions: http://tools.android.com/tech-docs/configuration/osx-jdk

    (The reason why Android Studio want's to run off of JRE 1.6 is because it apparently makes the fonts look better - feel free to go through that "official" route and install JRE 1.6 @ http://support.apple.com/kb/DL1572 - you can then set the JDK to 1.8 in the SDK Location settings - local.properties)

    0 讨论(0)
  • 2021-01-30 17:58

    Hey Friends I just Figured it out a simple way to fix this for Mac users.

    Open Terminal and type this -> java -version and hit enter.

    Output will be something like this:

    Now check your Java Version. My Java version is 1.8 So now we need to Open Contents of our Android App. For that right click the Android.app and then select Show Contents Like this

    Now there will be Content folder, Open that Folder and there you will find Info.plist

    Open this info.plist And you will see this.

    In this expand the JVM

    Here you will see the JVM version showing 1.6* but our jvm version is 1.8 (for example my jvm version is 1.8)

    So we need to change this number according to our jvm version, so i changed it to version 1.8*

    Then click save. And you are done. Now you will see setup wizard running

    And you are ready to start your first android programming app.

    Here is the Whole Docx file for Android Studio Setup in Mac X

    LINK: https://www.dropbox.com/s/9jwjebn5hgydyll/Android%20Studio%20Setup%20on%20Mac.docx?dl=0

    0 讨论(0)
  • 2021-01-30 18:02

    I did below command on Mac Terminal to fix this problem, please make sure java version and path.

    $java -version
     java version "1.8.0_25"
     Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
     Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
    
    $ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
    $ open /Applications/Android\ Studio.app
    
    0 讨论(0)
  • 2021-01-30 18:05

    Update 12/11/2014 As of Android Studio 1.0 RC3 you can follow this set of directions to make it work.

    I figured it out. You have to edit the android studio's Info.plist file in the package so it uses 1.7. I don't get why Android Studio insists we install and use an outdated, vulnerable version of Java.

    Location of file - you need to open it in the Applications folder Full resolution: http://i.stack.imgur.com/yyYaG.png

    To open the package you need to find the Android Studio.app file in the Applications folder and right click it > Show Package Contents.

    Edit the plist (I think you might need to be root) and change JVMVersion from 1.6* to 1.7* (or 1.8*, or whatever JDK major version you have). I don't get why that made a difference since my original output said it was using 1.7 anyways.

    This fix seems to apply to all of IntelliJ's IDEs (I've seen it on PyCharm as well), though other ones seem to support newer versions of java natively.

    0 讨论(0)
  • 2021-01-30 18:06

    I found that downloading an extra Java bundle from Apple fixed the issue.

    If you search for this problem then I found the second link was to a blog having exactly this problem, all credit goes to him here

    I know that posting links isn't an answer but as you can see from the resolution you need to make sure you have an up to date version of Java and also the Java bundle from Apple, for this reason I have also included the searches needed to get to these websites.

    Here is where to download the latest version of Java

    If this link is broken then searching "java latest version" return it at the top of the Google list

    Here is where to download the Apple Bundle

    If this link is broken then searching "Java for OS X 2014-001" returns it at the top of the Google list

    For me trying to solve this problem it appears that initially it was an issue that required a work around and then Apple released an official work around download meaning that fiddling in plists is not necessary any more.

    0 讨论(0)
  • 2021-01-30 18:10

    mgamerz is right - The release notes give a much better solution for rc3 and onwards - theres a idea.properties file (or environment variable)

    ~/Library/Preferences/AndroidStudio/idea.properties

    it also shows what environment variables you can use to set things like the jdk

    export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk

    ref : http://tools.android.com/recent/androidstudio1rc3_releasecandidate3released

    0 讨论(0)
提交回复
热议问题