-
Notifications
You must be signed in to change notification settings - Fork 0
Android's Java 8 Support
The new dex compiler is now D8 and was introduced in Android Studio 3.0.
It was made the default dexer in Android Gradle plugin 3.1 and it then became responsible for desugaring in 3.2.
See this article from 2017, and an example of generated bytecode (2018).
Sometimes, desugaring won’t help, and some parts of the Java 8 API need a minimum version of the Android API.
You can have a more precise idea of which new APIs was added in Java 8 by looking at Desugaring APIs.
For example, when using
list.sort( Comparator.comparing( <lambda or method reference> ) );
we will need API 24 (see reference doc).
Another example, the usage of Date / Time API is possible starting from API 26 (Oreo 8.0).
As explained in this article, desugaring will transform Java 8 class files to Java 7-compatible class files.
So you can use lambdas, method references and other features of Java 8.
-
Java 8 Language Features Support Update (developer.android.com, April 2017)
-
Supported Java 8 language features and APIs (developer.android.com, August 2017)
-
Blog from jakewharton.com : Android’s Java 8 Support