Can't run Android Studio on Yosemite

2019-01-21 10:39发布

Can't install Java 7 (installer refuses).

Can install Java 8.

But then starting Android Studio, it says it needs to install the legacy JDK 6, which is not going to work for me because our projects are already 1.7.

10条回答
Juvenile、少年°
2楼-- · 2019-01-21 10:53

Open a terminal and run

java -version

If it shows javac 1.8.*, then

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

otherwise (javac 1.7.*), then

<key>JVMVersion</key>
<string>1.7*</string>

If there is no display at all, you should install Java SDK.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-01-21 10:54

I've tried several solutions, downloading several sdk but Android Studio didn't recognize them as valid sdks.

Finally, the workaround that worked for me was:

  1. Delete "Android Studio.app" and Android Studio preferences (~/Library/Preferences/AndroidStudio).
  2. Rename /usr/libexec/java_home to java_home.bak.
  3. Install again Android Studio.
  4. When Android Studio prompts for a valid Java SDK, follow link provided by Android Studio and download that java installation.
  5. After installation, push detect button on Android Studio, and run.
查看更多
Ridiculous、
4楼-- · 2019-01-21 10:55

Got this all to work:

  • installed the legacy JDK
  • installed JDK 8

Found a thread that Oracle is going to update 1.7 so that the installer will not balk at 10.10 but that was not out yet.

This ended up working. Clearly the app itself is using 8 since my language level in my project is set to 1.7 and the legacy JDK is 1.6.

查看更多
ら.Afraid
5楼-- · 2019-01-21 10:55

for me the solution was:

  1. Open the Info.plist file inside Android Studio.app Folder. (use show package contents context menu)
  2. Find the key JVMVersion and replace the below version number string with 1.8*.
  3. Save

XML Info.plist should look like this

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

This Also works on Android Studio 0.9.9

查看更多
劫难
6楼-- · 2019-01-21 10:56

We now have an official page describing what to do: http://tools.android.com/tech-docs/configuration/osx-jdk

Please, please don't edit Info.plist; that has many downsides (including broken patches and application signatures breaking etc). As of Android Studio 1.0 we have a different way of setting the JDK to be used by the IDE.

查看更多
我想做一个坏孩纸
7楼-- · 2019-01-21 10:56

If you click "more..." on error dialog it will lead to Java for OS X 2014-001. Just download and install it.

查看更多
登录 后发表回答