Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Build Error : This version of Android Studio is incompatible with the Gradle Plugin used. Try disabling Instant Run

I upgraded Android Studio version from 1.5 to 2.0 today and something has gone wrong.
First I got Gradle version error, so I updated Gradle version from 2.10 to 2.12.

# previous
# distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
# current
distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip

Gradle version error has disappeared.
But now I have this error when I try to run my project:

Error running app: This version of Android Studio is incompatible with the Gradle Plugin used. Try disabling Instant Run (or updating either the IDE or the Gradle plugin to the latest version)


This is my Project Gradle.build:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0'
        classpath 'com.google.gms:google-services:2.1.0-alpha1'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

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

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


And this is my module:app Gradle.build file.

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'android-apt'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.test"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    dexOptions {
        maxProcessCount = 4 // this is the default value
        javaMaxHeapSize "4g"
        preDexLibraries = false
    }
}

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        mavenCentral()
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

repositories {
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
    mavenCentral()
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true; }
    compile('com.twitter.sdk.android:twitter:1.12.1@aar') { transitive = true; }

    apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.2'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.android.support:cardview-v7:23.3.0'
    compile 'com.android.support:palette-v7:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    compile 'com.android.support:support-v13:23.3.0'
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.google.android.gms:play-services-analytics:8.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.google.android.gms:play-services-maps:8.4.0'
    compile 'com.google.android.gms:play-services-location:8.4.0'
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
    compile 'com.facebook.android:facebook-android-sdk:4.6.0'
    compile 'com.paypal.sdk:paypal-android-sdk:2.13.3'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.github.hotchemi:permissionsdispatcher:2.1.2'
}

apply plugin: 'com.google.gms.google-services'


I disabled Instant Run from Preferences but nothing changed.
How can I resolve this error?
I'm struggling for half days.

like image 978
Suhyeon Lee Avatar asked Apr 19 '16 05:04

Suhyeon Lee


1 Answers

I deleted the build folder after cleaning project, and everything is just working fine now. :D
I don't know exactly why this happen, but maybe pre-built setting conflicted with new build setting.

like image 164
Suhyeon Lee Avatar answered Sep 21 '22 14:09

Suhyeon Lee