Skip to content
Tracking your ability to use new Java language features and APIs in an Android app
Java Kotlin Groovy
Branch: master
Clone or download

Latest commit

JakeWharton Add a variant with Android APIs
This is essential because of how the bootclasspath behaves. In reality we can't use anything newer than Java 8 and the prospect of doing so anytime soon is grim.
Latest commit 106e0c8 Mar 23, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Initial commit Mar 23, 2020
gradle/wrapper Initial commit Mar 23, 2020
projects Add a variant with Android APIs Mar 24, 2020
src/test/kotlin/com/jakewharton/javaversions Add a variant with Android APIs Mar 24, 2020
.gitignore Initial commit Mar 23, 2020
LICENSE.txt
README.md Add a variant with Android APIs Mar 24, 2020
build.gradle Initial commit Mar 23, 2020
gradlew Initial commit Mar 23, 2020
gradlew.bat Initial commit Mar 23, 2020

README.md

AGP Java Support

This repository tracks your ability to use new Java language features in an Android app.

AGP / Java 7 8 9 10 11 12 13 14
3.4.2
3.5.3
3.6.1
4.0.0-beta03
4.1.0-alpha03

Depressing! While there's no problem using JDK 14 to compile your app with source/target level 8, once you change the source/target level to 9 or higher the way javac compiles your code changes. Prior to Java 9, Java's APIs were exposed through something called rt.jar which was put on the "bootclasspath" of javac. Android used the same mechanism with its android.jar. When set to 9 or higher, javac uses the new module system which requires an entirely new mechanism of exposing the Android APIs.

So yeah. Not great.

Here's D8/R8's support of Java versions though:

AGP / Java 7 8 9 10 11 12 13 14
3.4.2
3.5.3
3.6.1
4.0.0-beta03
4.1.0-alpha03

Notes:

  • Just because a Java language version is supported does not mean all tools will handle it properly. For example, annotation processors and bytecode transformers may need updated.
  • Lint is not run on the test projects because is consumes an inordinate amount of memory and seems to have JVM metaspace leaks making automated testing difficult. Anecdotally, it seems to work fine on the latest stable, beta, and alpha for the working Java versions.
  • All projects are built with Gradle 6.3 RC4 which is required for running on Java 14. Older Gradle versions can probably be used with lower Java versions but are not tracked here.

Java 7

Java 8

Java 9

AGP usage blocked by https://issuetracker.google.com/issues/139013660.

Java 10

AGP usage blocked by https://issuetracker.google.com/issues/139013660.

Java 11

AGP usage blocked by https://issuetracker.google.com/issues/139013660.

Java 12

AGP usage blocked by https://issuetracker.google.com/issues/139013660.

D8 usage blocked by https://issuetracker.google.com/issues/141587937.

Java 13

AGP usage blocked by https://issuetracker.google.com/issues/139013660.

D8 usage blocked by https://issuetracker.google.com/issues/141587937.

Java 14

AGP usage blocked by https://issuetracker.google.com/issues/139013660.

D8 usage blocked by https://issuetracker.google.com/issues/141587937.

You can’t perform that action at this time.