Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

How do I see JVM path on Mac?

In macOS, the JDK installation path is /Library/Java/JavaVirtualMachines/jdk-10. jdk/Contents/Home . The root directory of the JDK software installation. This directory also contains copyright, README, and src.

Does macOS have JVM?

Mac OS X 10.7 (Lion) and above: Java is not pre-installed with Mac OS X versions 10.7 and above. To get the latest Java from Oracle, you will need Mac OS X 10.7. 3 and above. If you have Java 7 or later versions, you will see a Java icon under System Preferences.

Is JVM required for Android studio?

The Android Studio make use of JAVA_HOME environment variable to find the JVM installation. If you have not set the JAVA_HOME then you must do so by going into My Computer -> System Properties -> System Settings ->Environment Variables. Make sure your JAVA_HOME points to 64-bit JDK installation e.g. JDK 1.8.


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!


Just install this guy here

http://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US

and you should be good.


[Update]
This is fixed in Android Studio 1.1 https://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


Note that this last variable allows you to for example run Android Studio with Java 7 on OSX (which normally picks Java 6 from the version specified in Info.plist):

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

$ open /Applications/Android\ Studio.app

Worked for me