How to resolve Gradle plugin requires Studio 3.0 minimum

Viewed 59030
7 Answers

this Error occurs when you are trying to import Project which is created in studio 3.0 and above into Android Studio 2.3.3 or below. make following changes to work in Studio below 3

1)in Project gradle add below configuration:

buildscript {

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

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

}

2) in App (or module) gradle file

remove following lines if there are any

compileOptions {
    targetCompatibility 1.8
    sourceCompatibility 1.8
}

and change all implementation and annotationProcessor in dependency to compile like below

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation 'com.android.support:appcompat-v7:26.1.0'   
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'android.arch.lifecycle:runtime:1.0.0'
implementation 'android.arch.lifecycle:extensions:1.0.0-alpha9-1'
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha9-1"
implementation 'android.arch.persistence.room:runtime:1.0.0-alpha9-1'
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha9-1"
implementation 'android.arch.paging:runtime:1.0.0-alpha1'
implementation 'com.android.support:recyclerview-v7:26.0.2'

}

To

dependencies {
//implementation fileTree(include: ['*.jar'], dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'libs')

compile 'com.android.support:appcompat-v7:26.1.0'

compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'android.arch.lifecycle:runtime:1.0.0'
compile 'android.arch.lifecycle:extensions:1.0.0-alpha9-1'
compile "android.arch.lifecycle:compiler:1.0.0-alpha9-1"
compile 'android.arch.persistence.room:runtime:1.0.0-alpha9-1'
compile "android.arch.persistence.room:compiler:1.0.0-alpha9-1"
compile 'android.arch.paging:runtime:1.0.0-alpha1'
compile 'com.android.support:recyclerview-v7:26.0.2'

}

I was facing the same issue, it can be resolved by changing the gradle and android plugin version using following steps.

File -> Project Structure -> Project -> change gradle version to 3.3 and android plugin version to the android studio version you are using. -> Rebuild your project.

enter image description here

It may give some error for methods which were not in previous gradle versions. One that you mentioned in one of your comment GradleError:(25, 0) Gradle DSL method not found: 'implementation()' can be resolved by replacing implementation by compile.

May be you have resolved you issue but may help others.

Once I downloaded the project created in Android Studio v3 and I had v2.3.3. So when I tried to launch the project there were some incompatibility issues. And for those who faced the same problem the solution is the following: 1. Go to File=> Project Structure=> Project and change Gradle version to 3.3 and Android Plugin version to 2.3.3 2. In CinemaProject build.gradle file: 2.1. Delete "google()" methods wherever you see it in the file 2.2. Change allprojects section in the file like that:

allprojects {
    repositories {
        jcenter()

        maven {
            url "https://maven.google.com"
        }
    }
}
  1. In app build.gradle file : Add buildToolsVersion "26.0.0" in android {} section after compileSdkVersion

Change the following

dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'


        compile 'com.android.support:cardview-v7:26.1.0'
        compile 'com.android.support:recyclerview-v7:26.1.0'


        compile 'com.mcxiaoke.volley:library:1.0.19'
        compile 'com.google.code.gson:gson:2.8.2'


        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.1'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    }

Like that

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'

    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'

    compile 'com.mcxiaoke.volley:library:1.0.1'
    compile 'com.google.code.gson:gson:2.7'

    testCompile  'junit:junit:4.12'

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
}
Related