Android Studio可以使用OpenJDK还是需要Linux上的Oracle JDK?

时间:2022-07-17 07:01:43

Can Android Studio use OpenJDK 1.8 or does it require Oracle JDK on Linux? It would be easier to use OpenJDK because it comes installed on Fedora.

Android Studio可以使用OpenJDK 1.8,还是需要Linux上的Oracle JDK?使用OpenJDK会更容易,因为它安装在Fedora上。

I'm running 64 bit Fedora-23 linux with Android Studio 1.5.1.build AI-141.2456560 on an Intel Haswell i7 chip.

我在Intel Haswell i7芯片上使用Android Studio 1.5.1.build AI-141.2456560运行64位Fedora-23 linux。

$ java -version
openjdk version "1.8.0_72"
OpenJDK Runtime Environment (build 1.8.0_72-b15)
OpenJDK 64-Bit Server VM (build 25.72-b15, mixed mode)

$ ./java -version
java version "1.8.0_73"
Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)

$ uname -a
Linux localhost.localdomain 4.3.5-300.fc23.x86_64 #1 SMP Mon Feb 1 03:18:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ more build.txt 
AI-141.2456560

2 个解决方案

#1


3  

No, just as the android documentations says, Oracle JDK is required. I got a "null pointer exception" on render on when running a simple build of an empty project with openJDK. This error probably came from the IDE, not the build of the APK file.

不,就像Android文档说的那样,Oracle JDK是必需的。当使用openJDK运行一个简单的空项目构建时,我在渲染时得到了一个“空指针异常”。此错误可能来自IDE,而不是APK文件的构建。

After running studio with Oracle's JDK, it all worked properly with no change to the code.

在使用Oracle的JDK运行工作室之后,一切正常,没有更改代码。

Actually it gets more complicated than that because, I have both versions on my system. Oracle JDK is used to launch the studio.sh file, but inside studio I still have the OpenJDK specified under "Project Structure> JDK" as:

实际上它比这复杂得多,因为我的系统上有两个版本。 Oracle JDK用于启动studio.sh文件,但在工作室内我仍然在“Project Structure> JDK”下指定OpenJDK:

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64

I'll report back if this hybrid situation fails.

如果这种混合情况失败,我会报告回来。

#2


2  

I am using Android Studio since version 1.0 (currently 2.0 beta) on Fedora 64 bit (currently 23) and OpenJDK. It used to display a warning saying something like "OpenJDK is not supported, do not open bug reports if something goes wrong", I don't know if it it still does (I may have clicked on "Don't show this again").

我在Fedora 64位(目前为23位)和OpenJDK上使用Android Studio 1.0版(目前为2.0 beta)。它曾经显示一个警告,说“不支持OpenJDK,如果出现问题就不要打开错误报告”,我不知道它是否仍然存在(我可能已点击“不再显示此内容”) )。

There was also a warning about libinput but I think it is not related to OpenJDK.

还有关于libinput的警告,但我认为它与OpenJDK无关。

Anyway in my case it works quite well, as far as I can remember I did not have to use special tricks. Obviously your mileage may vary.

无论如何,在我的情况下,它工作得很好,据我所知,我没有必要使用特殊的技巧。显然你的里程可能会有所不同。

#1


3  

No, just as the android documentations says, Oracle JDK is required. I got a "null pointer exception" on render on when running a simple build of an empty project with openJDK. This error probably came from the IDE, not the build of the APK file.

不,就像Android文档说的那样,Oracle JDK是必需的。当使用openJDK运行一个简单的空项目构建时,我在渲染时得到了一个“空指针异常”。此错误可能来自IDE,而不是APK文件的构建。

After running studio with Oracle's JDK, it all worked properly with no change to the code.

在使用Oracle的JDK运行工作室之后,一切正常,没有更改代码。

Actually it gets more complicated than that because, I have both versions on my system. Oracle JDK is used to launch the studio.sh file, but inside studio I still have the OpenJDK specified under "Project Structure> JDK" as:

实际上它比这复杂得多,因为我的系统上有两个版本。 Oracle JDK用于启动studio.sh文件,但在工作室内我仍然在“Project Structure> JDK”下指定OpenJDK:

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-4.b15.fc23.x86_64

I'll report back if this hybrid situation fails.

如果这种混合情况失败,我会报告回来。

#2


2  

I am using Android Studio since version 1.0 (currently 2.0 beta) on Fedora 64 bit (currently 23) and OpenJDK. It used to display a warning saying something like "OpenJDK is not supported, do not open bug reports if something goes wrong", I don't know if it it still does (I may have clicked on "Don't show this again").

我在Fedora 64位(目前为23位)和OpenJDK上使用Android Studio 1.0版(目前为2.0 beta)。它曾经显示一个警告,说“不支持OpenJDK,如果出现问题就不要打开错误报告”,我不知道它是否仍然存在(我可能已点击“不再显示此内容”) )。

There was also a warning about libinput but I think it is not related to OpenJDK.

还有关于libinput的警告,但我认为它与OpenJDK无关。

Anyway in my case it works quite well, as far as I can remember I did not have to use special tricks. Obviously your mileage may vary.

无论如何,在我的情况下,它工作得很好,据我所知,我没有必要使用特殊的技巧。显然你的里程可能会有所不同。