问题描述
Android Studio可以使用OpenJDK 1.8,还是需要Linux上的Oracle JDK?使用OpenJDK会更容易,因为它安装在Fedora上。
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 1.5.1运行64位Fedora-23 linux.build AI-141.2456560在Intel Haswell i7芯片上。
I'm running 64 bit Fedora-23 linux with Android Studio 1.5.1.build AI-141.2456560 on an Intel Haswell i7 chip.
$ 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
推荐答案
不,就像android文档说的那样,Oracle JDK是必需的。当使用openJDK运行一个简单的空项目构建时,我在渲染时得到了一个空指针异常。这个错误可能来自IDE,而不是APK文件的构建。
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.
使用Oracle的JDK运行工作室后,一切正常,没有更改代码。
After running studio with Oracle's JDK, it all worked properly with no change to the code.
实际上它比这复杂得多,因为我的系统上有两个版本。 Oracle JDK用于启动studio.sh文件,但在工作室内我仍然在项目结构> JDK下指定的OpenJDK:
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:
/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.
这篇关于Android Studio可以使用OpenJDK还是需要Linux上的Oracle JDK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!