简体   繁体   English

OS X上的Android Studio和JRE

[英]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; 在OS X上安装AndroidStudio 2.0 El Capitan:如果我从http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html安装JRE 7,我将不会收到公共更新; if I install JRE 8, Android Studio complains that it cannot use secure connection to receive upgrades: 如果我安装JRE 8,Android Studio会抱怨它无法使用安全连接来接收升级:

Android Studio和Java截图

Is there a way to convince AS that JRE 8 is not JRE 6? 有没有办法说服AS,JRE 8不是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? 如果不可能,哪种折衷方案更可取:降级到JRE 7并为Android Studio升级建立安全连接,或保留最新的JRE并等待Android Studio修复?

From the documentation, by default Android Studio is launched from java 6: http://tools.android.com/tech-docs/configuration/osx-jdk 从文档中,默认情况下,Android Studio是从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 : 如上所述,您可以导出env变量以指示Android Studio使用的jdk:

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 : 为了保持从GUI访问此env变量,您可以将以下行添加到〜/ .profile文件中:

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". OSX的另一个解决方案:转到Applications文件夹,右键单击Android Studio,选择“Show Package Contents”。

Open the Info.plist file. 打开Info.plist文件。 Locate the JVMVersion key, and set the string value you need. 找到JVMVersion项,然后设置所需的字符串值。

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+. 在我的情况下,我需要1.7以上才能运行RoboVM插件,值为1.6 *,1.7 +,所以我只留下1.7+。

Restart Android Studio and it should be using the version of the JVM you need. 重新启动Android Studio,它应该使用您需要的JVM版本。

This works if you have root access on your Mac. 如果您在Mac上具有root访问权限,则此方法有效。

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


In Android Studio 2.1.2 and below,the default settings is '1.6*,1.7+'. 在Android Studio 2.1.2及更低版本中,默认设置为“1.6 *,1.7 +”。

In the latest version of Android Studio(2.2 Preview 7),the default settings is '1.8*,1.8+'. 在最新版本的Android Studio(2.2预览版7)中,默认设置为“1.8 *,1.8 +”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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