2

Android Studio on my Mac can not start.

A Java Update dialog is shown when I open the Android Studio app. The dialog's content is:

Java version: 1.6.0_51-b11-457 which is installed on your Mac is obsolete. Would you like to update Java?

I pressed the update button, the Java Update dialog disappeared, but nothing happens after that.

When I run command java -version on terminal. The result is:

java version "1.8.0_92" Java(TM) SE Runtime Environment (build 1.8.0_92-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

I had installed java via brew cask install java and Android Studio via brew cask install android-studio

My MacOS version is: OS X El Capitan 10.11.5

The Android Studio version is 2.1.1.0,143.2821654 as I look at homebrew cask's installation folder /opt/homebrew-cask/Caskroom/android-studio/2.1.1.0,143.2821654/'s name

This problem has already token takes me hours of googling, but there is still no way to continue. Finally, I decided to go to StackOverflow :(.

Could anyone tell me how should I do to use Android Studio?

Many thanks,

Sang
  • 4,049
  • 3
  • 37
  • 47
  • 1
    What does your JAVA_HOME point to? http://stackoverflow.com/q/6588390/1793718 You should see this similar post http://stackoverflow.com/a/27369596/1793718 What version of Android Studio are you using? – Lucky May 30 '16 at 06:26
  • @Lucky I edited my post to add Android Studio version. It is the latest version from homebrew-cask. There is no export of JAVA_HOME, so I think it be empty After set JAVA_HOME to `"$(/usr/libexec/java_home)"`, there is still error of obsoleted java – Sang May 30 '16 at 07:01
  • You must be having separate versions of JDK & JRE. How did you install Java on your MAC at first? Is it a pre-installed version or you installed it from Oracle installer? – Swaps May 30 '16 at 07:09
  • 1
    I installed by `brew cask install java` – Sang May 30 '16 at 07:34
  • I think if you don't want to manage multiple Java versions you should install JDK directly with the installer provided by Oracle, and try reinstalling the Android studio. – Swaps May 30 '16 at 08:41
  • I will consider that. Until now, I have never installed anything from .pkg file. All apps in my Mac were installed using `brew` – Sang May 30 '16 at 09:25
  • Possible duplicate of [Android Studio was unable to find a valid Jvm (Related to MAC OS)](http://stackoverflow.com/questions/27369269/android-studio-was-unable-to-find-a-valid-jvm-related-to-mac-os) – ryenus Sep 22 '16 at 05:15

1 Answers1

2

Follow this question, when the Java Update dialog shows, right click to its icon under docker bar > Options > Show in finder

Open package content of Android Studio.app to edit info.plist. Change JVMOptions->JVMVersion from 1.6*,1.7+ to 1.6+,1.7+.

Now it works

Community
  • 1
  • 1
Sang
  • 4,049
  • 3
  • 37
  • 47