Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Instant run not working using java 8 in android

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

like image 632
Qamar Avatar asked Jul 12 '16 08:07

Qamar


People also ask

Can I use Java 8 in Android Studio?

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.

Does Android Studio still have instant run?

Instant Run is currently available only in Android Studio 2.0, and higher. We will continue to improve the feature in subsequent releases.

Why Android Studio is not running the app?

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.


2 Answers

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

like image 145
Eliahu Horwitz Avatar answered Sep 20 '22 21:09

Eliahu Horwitz


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

like image 25
Maxime Mbabele Avatar answered Sep 20 '22 21:09

Maxime Mbabele