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.
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
This is an official text editor and integrated development environment (IDE) for developing Android apps. You must install Oracle JDK before installing Android Studio, so please don't start this step until you have completed Step 1 above. Download Android Studio from the following address: Android Studio Download Page.
There's no real technical difference between the two, since the build process for Oracle JDK is based on that of OpenJDK. When it comes to performance, Oracle's is much better regarding responsiveness and JVM performance. It puts more focus on stability because of the importance it gives to its enterprise customers.
You will always have an OpenJDK version that works for Android development. Downloading Oracle's JDK 9 or greater won't affect the development experience.
Android is behind the Java development. It uses most of Java 7's features with some features of Java 8 (like click listeners using lambdas). So, if you would like to be able to copy-paste code from your java applications to Android ones, it is better to stick to Java 8. Save this answer.
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.
After running studio with Oracle's JDK, it all worked properly with no change to the code.
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.
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").
There was also a warning about libinput but I think it is not related to 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.
Below found in android docs
OpenJDK comes bundled with Android Studio 2.2 and higher, and this is the JDK version we recommend you use for your Android projects.
shout out to @Abilogos
Docs: https://developer.android.com/studio/intro/studio-config#jdk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With