Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instant Run not working in Android Studio 3.0

I am getting a DexArchiveBuilderException with instant run on Android studio 3.0. Gradle builds fine, but I get an error trying to deploy the apk.

Disabling instant run fixes the issue.

How can I get this working with instant run?

Full error:

Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/vedantagarwala/dunzo/cappuccino/android-final/demo/build/intermediates/transforms/instantRunSlicer/debug/9

// Top-level build file:

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
        classpath 'com.github.dcendents:android-maven-plugin:1.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

ext {

    compileSdkVersion = 27
    buildToolsVersion = "26.0.2"

    targetSdkVersion = 22
    minSdkVersion = 15
    androidSupportLibVersion = "25.3.1"
    googlePlayServiceVersion = "10.0.1";
    resConfigs = ["en"];
    // You can also create properties to specify versions for dependencies.
    // Having consistent versions between modules can avoid conflicts with behavior.
}

I have tried solutions online, like upgrading/downgrading gradle and/or dependencies, but nothing worked.

JDK:

$ java -version
openjdk version "1.8.0_152-release"
OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
OpenJDK 64-Bit Server VM (build 25.152-b08, mixed mode)
like image 902
Vedant Agarwala Avatar asked Nov 14 '17 09:11

Vedant Agarwala


1 Answers

if your device running on MIUI, go to Developer Settings -> Turn on MIUI optimization and turn it off. then you need to restart your device and recompile the code. Instant Run should be up and running again!

like image 73
Kiran Maniya Avatar answered Oct 21 '22 05:10

Kiran Maniya