I followed the Android Java 8 Features manual. It works well for Android application project. But when I try to use it with Android library project I get
Error:L
This sure has been a long ride. I tried all possible combinations of the gradle plugin, the experimental gradle plugin + retrolambda
+ Jack
etc, but with no luck. Until now. From Android Studio 3.0 Preview 1 or later (and, consequently, the Android Gradle plugin 3.0.0-alpha1
or later), the Jack
toolchain is deprecated and replaced by some new bytecode transformation - sugaring, used in conjunction with the standard javac
compiler.
With this setup I've personally (finally!!!) been successful in using Java 8 features such as lambdas in a library project.
This page has all the techy info as well as migration help etc: https://developer.android.com/studio/write/java8-support.html