简体   繁体   中英

Android Studio and JRE on OS X

Installing AndroidStudio 2.0 on OS X El Capitan: if I install JRE 7 from http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html , I will not receive Public Updates; if I install JRE 8, Android Studio complains that it cannot use secure connection to receive upgrades:

Android Studio和Java截图

Is there a way to convince AS that JRE 8 is not JRE 6? If impossible, which compromise is preferable: downgrade to JRE 7 and establish secure connection for Android Studio upgrades, or keep the latest JRE and wait for Android Studio fix?

From the documentation, by default Android Studio is launched from java 6: http://tools.android.com/tech-docs/configuration/osx-jdk

As it is mentioned you can export an env variable to indicate Android Studio what jdk to use :

export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk<version>.jdk

In order to keep this env variable accessible from the GUI, you can add the following line to your ~/.profile file :

launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk<version>.jdk

Hope it helps.

Another solution for OSX: go to the Applications folder, right click on Android Studio, choose "Show Package Contents".

Open the Info.plist file. Locate the JVMVersion key, and set the string value you need.

In my case, I needed to be 1.7 and up to be able to run the RoboVM plugin, and the value was 1.6*,1.7+, so I left it only on 1.7+.

Restart Android Studio and it should be using the version of the JVM you need.

This works if you have root access on your Mac.

refers to Android Studio IDE with private jre/jdk? OSX


In Android Studio 2.1.2 and below,the default settings is '1.6*,1.7+'.

In the latest version of Android Studio(2.2 Preview 7),the default settings is '1.8*,1.8+'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM