Tuesday, September 16, 2014

Android Studio - Set JVM Version in Mac OSX 10.7+

I downloaded Android Studio 0.8.9 Build 123.1404660 into my Mac OSX 10.9. After install it into "Appliations", try to start and I got a "To open Android Studio, you need a JAVA SE 6 runtime. Would you like to install one now"? I do have JDK_1.8.0 installed on my Mac.

First I thought it was the "JAVA_HOME" parameter unset. So I set "JAVA_HOME" in my .bash_profile:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home

But when I try to load "Android Studio" again, the same error showed up.

Turns out you have to edit the Android Studio's info.plist file in the package so it uses 1.8.

Go to "Applications" -> "Android Studio" -> "Contents" -> "Info.plist", find the line:
<key>JVMVersion</key>
<string>1.6*</string>

change it to 

<key>JVMVersion</key>
<string>1.8*</string>

If you have JDK_1.7.0* you should use 1.7*. That's it, happy coding!

No comments: