Fresh install of El Capitan(10.11), tried to install Android Studio version 1.21.
Error:
Android Studio was unable to find a valid JVM. Please download it
You can either
If you favor the latter, you must first download and install the JDK8.
Then unless Android Studio picks it up automatically, you'll have to configure it to use the newly installed JDK but not through its Info.plist
as is often recommended but through a STUDIO_JDK
environment variable (see link below for details).
This can be done from the command line, in order to make sure Android Studio starts properly using JDK8:
$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.*_**.jdk
$ open /path/to/Android\ Studio.app
but you most likely want to also be able to open it from the GUI. In this case you can refer to this SO thread on how to create a plist
launch agent which will be able to set the STUDIO_JDK
variable for launchd
by substituting the command in the linked answer snippet with
launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.*_**.jdk
(of course replace *
with your currently installed version).
Lastly, you should check the official documentation on the selection of the JDK for Android Studio for more details on the procedure, the drawbacks, the rationale behind the method I described above and information on how to set up the project (not just IDE) JDKs as well.