Search code examples
android-studioandroid-instant-run

Android Studio Instant Run restart application always


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.