Which Java JDK should I install for the use of Android Studio
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).
To make Android Studio "understand" Java 8, you have to add the following options to your app's build.gradle android section:
compileOptions{
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
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.
The official doc says:
Set the JDK version
A copy of the latest OpenJDK comes bundled with Android Studio 2.2 and higher, and this is the JDK version we recommend you use for your Android projects. To use the bundled JDK, do the following:
- Open your project in Android Studio and select File > Project Structure in the menu bar.
- In the SDK Location page and under JDK location, check the Use embedded JDK checkbox.
- Click OK.
So there is no need to install a standalone JDK if you are not planning to do Java Devs other than Android App.