Using java 8 for concise Lambda expression etc but downside is instant run not working. buildToolsVersion "23.0.3"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
how to enable instant run with java 8 features
Java 8 language features are now supported by the Android build system in the javac/dx compilation path. Android Studio's Gradle plugin now desugars Java 8 class files to Java 7-compatible class files, so you can use lambdas, method references and other features of Java 8.
Instant Run is currently available only in Android Studio 2.0, and higher. We will continue to improve the feature in subsequent releases.
Unplug your device from the USB port on the computer. Restart the device by powering off and back on. Verify that Settings => Developer options => USB Debugging is enabled. Quit and re-launch Android Studio.
From offical documenataion:
Known Issues Instant Run does not currently work with Jack and will be disabled while using the new toolchain.
https://developer.android.com/preview/j8-jack.html
Patience is a virtue. Support for Java 1.8 will be built in Android studio without the need of any configuration or external libraries in the near future (weeks from now)
https://android-developers.googleblog.com/2017/03/future-of-java-8-language-feature.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With