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:
❌ AGP usage blocked by https://issuetracker.google.com/issues/139013660.
❌ AGP usage blocked by https://issuetracker.google.com/issues/139013660.
❌ AGP usage blocked by https://issuetracker.google.com/issues/139013660.
❌ AGP usage blocked by https://issuetracker.google.com/issues/139013660.
❌ D8 usage blocked by https://issuetracker.google.com/issues/141587937.
❌ AGP usage blocked by https://issuetracker.google.com/issues/139013660.
❌ D8 usage blocked by https://issuetracker.google.com/issues/141587937.
❌ AGP usage blocked by https://issuetracker.google.com/issues/139013660.
❌ D8 usage blocked by https://issuetracker.google.com/issues/141587937.