Android Studio was unable to find a valid Jvm (Related to MAC OS) Android Studio was unable to find a valid Jvm (Related to MAC OS) java java

Android Studio was unable to find a valid Jvm (Related to MAC OS)


Open the application package for Android Studio in finder, and edit the Info.plist file. Change the key JVMversion. Put 1.6+ instead of 1.6*. That worked for me!.

Cheers!

Edited:

While this was necessary in older versions of Android Studio, this is no longer recommended. See the official statement

"Please note: Do not edit Info.plist to pick a different version. That will break not only the application signature, but also future patch updates to your installation."

Antonio Jose's answer is the correct one.

Thanks aried3r!


[Update]
This is fixed in Android Studio 1.1https://issuetracker.google.com/issues/37015035

In the next version of Android Studio, if no java 6 is found but 7 (or greater) is found then it will use that instead. We still recommend running studio with Java 6 due to improved font rendering, but there is no work around needed if, for example, only java 8 is found.

[End Update]

From Android Studio 1.0 RC3 Notes

As of RC 3, we have a better mechanism for customizing properties for the launchers on all three platforms. You should not edit any files in the IDE installation directory. Instead, you can customize the attributes by creating your own .properties or .vmoptions files in the following directories. (This has been possible on some platforms before, but it required you to copy and change the entire contents of the files. With the latest changes these properties are now additive instead such that you can set just the attributes you care about, and the rest will use the defaults from the IDE installation).

However there is no explanation about what options are.

After searching a little I found this
Adjusting VM Options for Android Studio on Mac
IntelliJ IDEA 14.0.0 Web Help/File IDEA.Properties

However no luck with that.

Fortunately I was able to resolve it on Yosemite using environment variables as said in the 1.0 RC3 Release Notes.

You can also place use environment variables to point to specific override files elsewhere:
STUDIO_VM_OPTIONS, which vmoptions file to use
STUDIO_PROPERTIES, which property file to use
STUDIO_JDK, which JDK to run studio with

This was a little tricky because Android Studio is not a command line application so I had to use a AppleScript command to set the environment variable when login. More info here

This is my launchctl command for the command line.

launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk

And this my AppleScript (remember to save it as an Application)

do shell script "launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk"

About launchctl, see here