Android Studio Instant Run restart application always

Issue

In Android Studio, the “Instant Run” function “Apply changes” enter image description here restart application always, even if no change in code (Android Studio 2.3.0 – MacOS 10.12.3). This happen when application is in Debug and paused on a break point, if then I try to apply change the app restart enter image description here

This is my build.gradle:

apply plugin: 'com.android.application'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}
buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
    }
}
allprojects {
    repositories {
        mavenCentral()
    }
}


android {
    compileSdkVersion 23
    buildToolsVersion '25.0.2'
    dexOptions {
        javaMaxHeapSize "4g"
    }
    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 23
        multiDexEnabled true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }



    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src/main/java']
            resources.srcDirs = ['src/main/java']
            aidl.srcDirs = ['src/main/java']
            renderscript.srcDirs = ['src/main/java']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        //instrumentTest.setRoot('tests')
    }
}

Solution

Instant Run is always disabled in the debugger:

On Android Studio 2.3, if you deploy your app by clicking Debug , pushing subsequent code changes by clicking Apply Changes always results in a cold swap. To learn more, go to issue #234401.

From https://developer.android.com/studio/run/index.html#instant-run

Other than that, your configuration seems to check all the boxes.

Answered By – Pierre-Luc Paour

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published