Can Android Studio use OpenJDK or is it required Oracle JDK for Linux?

Can Android Studio use OpenJDK 1.8 or is Oracle JDK required for Linux? It would be easier to use OpenJDK because it is installed on Fedora.

I am using the 64-bit version of Fedora-23 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 
+6
source share
2 answers

No, as the android documentation claims, Oracle JDK is required. I got a null pointer exception when rendering when starting a simple build of an empty project with openJDK. This error probably came from the IDE, not the build of the APK file.

After starting the studio with Oracle JDK, all this worked correctly, without changing the code.

Actually, this gets complicated because I have both versions on my system. The Oracle JDK is used to run the studio.sh file, but inside the studio I still have the OpenJDK specified in the "Project Structure> JDK" section:

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

I will report if this hybrid situation failed.

+3
source

I am using Android Studio from version 1.0 (currently 2.0 beta) on Fedora 64 bit (currently 23) and OpenJDK. He used to display a warning saying "OpenJDK is not supported, don’t open error reports if something goes wrong," I don’t know if he continues to do this (maybe I clicked "Do not show it again")).

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

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

+2
source

All Articles