Does Android Studio 3 support Java 9 for Android development? If so, what features of Java 9 are supported? Does Android Studio 3 support Java 9 for Android development? If so, what features of Java 9 are supported? android android

Does Android Studio 3 support Java 9 for Android development? If so, what features of Java 9 are supported?


As far as I know, the IDE itself supports Java 9. This means you can write a Java 9 desktop program, or run the IDE with JDK 9.

However, Android itself does not support Java 9 (yet). You can still download JDK 9, although I have seen some questions on problems related to Android Studio and Java 9. Personally, I have Java 9 and Android Studio runs without problems.

The Android SDK is the development kit you'll be dealing with, and with source compatibility you'll get language features similar to Java 6, 7, or 8, depending on your settings. So you can download JDK 9 and use that most likely without issues, but you can't use any of the language features in any Android apps.

As for differences between the JDK and the Android SDK, you should read this. Android currently supports a subset of Java 8 features, but not everything. It might never support everything, or leave out some parts of Java 8, even if it later supports some parts on Java 9 or higher.


UPDATE: as of https://jakewharton.com/androids-java-8-support/, it seems like this should almost work by now (as well as for Java 9, 10, 11, and 12). Or just use Kotlin.

To help the last steps along, you can star the issue.


As of now, the Android SDK does not even support java 8 completely:

Android Studio 3.0 and later supports all Java 7 language features and a subset of Java 8 language features that vary by platform version. This page describes the Java 8 language features you can use, how to properly configure your project to use them, and any known issues you may encounter. [emphases mine]

That probably needs to be supported completely before Java 9 is approached.


Just tried to do it with Ubuntu 18.04 which uses Java 10 already. You run into tons of problems from invalid java certificates to extra warnings on gradle invocations etc. It's a mess and hopefully solved soon, you will find solutions to every problem via google but it's more easy to install Java 8 instead.

I have no idea about using the language itself inside Android application code, because i'm a full NDK C++ programmer and only use the toolchain which contains many java programs.