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

35,828

Solution 1

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.

Solution 2

I faced this issue after updating Android Studio to 2.3! I didn't delete any file!

Just cleaned the project and it worked!

Solution 3

On Android 2.0 and above.

1 - In Settings -> Build, Execution, Deployment option -> Instant Run

2 - Clear Enable instant run to hot swap code

3 - Clean project

p/s : It should totally work.

Solution 4

I'm Using Android Studio 2.2, and for me... Clean the project and delete build folder solved the issue.

I have just one different with you. I putted on build.gradle. classpath 'com.android.tools.build:gradle:+'

Solution 5

Make sure that Android Studio up to date!!

AndroidStudio > Help > Check For Updates ...

Share:
35,828
Suhyeon Lee
Author by

Suhyeon Lee

Updated on July 21, 2022

Comments

  • Suhyeon Lee
    Suhyeon Lee almost 2 years

    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.

  • fazil
    fazil over 7 years
    I deleted the build folder and cleaned the project but still same error is dispalyed
  • fazil
    fazil over 7 years
    For Gradle 2.0 + follow the @Tran Duc Huy.Worked for me
  • lhunath
    lhunath about 7 years
    Disabling Instant Run is not a fix.
  • Huy Tower
    Huy Tower about 7 years
    As for someone, "For Gradle 2.0 + follow the @Tran Duc Huy.Worked for me"