简体   繁体   English

未设置STUDIO_JDK时,默认JDK用于android studio

[英]Default JDK used for android studio when STUDIO_JDK is not set

I am building a plugin for Android Studio using IntelliJ but it always shows this error when I try to load it on Android Studio. 我正在使用IntelliJ为Android Studio构建一个插件,但是当我尝试在Android Studio上加载它时,它总是显示此错误。 Unless I set STUDIO_JDK to the jdk1.8 path. 除非我将STUDIO_JDK设置为jdk1.8路径。

com.intellij.diagnostic.PluginException: MyComponent :
Unsupported major.minor version 52.0

So I wonder what JDK will android studio pick up by default when STUDIO_JDK is not set. 所以我想知道当STUDIO_JDK没有设置时,默认情况下JDK会将android studio选中。

It says 它说

Unsupported major.minor version 52.0 不支持的major.minor版本52.0

you should try using jdk 1.8 with different major.minor version (other than 52.0) 你应该尝试使用jdk 1.8与不同的major.minor版本(52.0除外)

I found the answer to this question later. 我后来找到了这个问题的答案。 If you open "About Android Studio" you can see JRE 1.6 . 如果您打开“关于Android Studio”,您可以看到JRE 1.6 It means Android Studio is running on java 1.6 environment by default, no matter what "JDK" you are using for development. 这意味着默认情况下Android Studio在java 1.6环境中运行,无论您使用什么“JDK”进行开发。 Of course there are ways to change this. 当然有办法改变这种状况。 You can put the jdk path in STUDIO_JDK and run Android Studio with that(initiate from terminal where you set STUDIO_JDK). 您可以将jdk路径放在STUDIO_JDK中并使用它运行Android Studio(从设置STUDIO_JDK的终端启动)。 As a consequence of this, you will have to use JDK 1.6 when you develop a plugin for Android Studio so that it can work on the default setting. 因此,在为Android Studio开发插件时,必须使用JDK 1.6,以便它可以在默认设置下工作。

Android Studio running on JRE 1.6 by default.I assumed that u have multi JDK and to change this JRE on Android Studio you need to delete/move default JDK (1.6). 默认情况下,Android Studio在JRE 1.6上运行。我认为你有多个JDK,要在Android Studio上更改此JRE,你需要删除/移动默认的JDK(1.6)。 OSX : OSX:

sudo mv /Library/Java/JavaVirtualMachines/1.6.0.jdk /tmp

Finally check on "About Android Studio" 最后查看“关于Android Studio”

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

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