android – How to resolve Gradle plugin requires Studio 3.0 minimum-ThrowExceptions

Exception or error:

I am getting Error:This Gradle plugin requires Studio 3.0 minimum when importing project
Project repo: https://github.com/chrisbanes/cheesesquare
I had tried mentioned solution provided here and here but nothing worked 🙁

How to solve:

The repository you’re trying to import uses gradle build tools 3.0.0 and gradle 4.0. These aren’t supported in Android Studio 2.3, which means that project can only be opened in Android Studio 3.0 preview.

Your options:

1) Download android studio 3.0 preview and use it for the project

2) Check out repository and revert it to just before commit 822b84a1e58126412f708745d8bcee5a525620ae (which is where the conversion to latest version of gradle happened)

###

Option #1: Do not attempt to import the project until you upgrade to Android Studio 3.0

Option #2: Modify the project:

  • Change the project-level build.gradle to refer to com.android.tools.build:gradle:2.3.3 instead of com.android.tools.build:gradle:3.0.0-alpha6

  • Change gradle/wrapper/gradle-wrapper.properties to refer to https\://services.gradle.org/distributions/gradle-3.3-all.zip instead of https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip

  • Import the project and pray that its author is not depending on things that you changed

###

replace

    classpath 'com.android.tools.build:gradle:3.0.0-alpha4'

with

    classpath 'com.android.tools.build:gradle:2.3.3'

in the projects build.gradle files.

###

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'
    })
}

###

see the solution or problemhi guys i solve this issue i want to explain you you check your android studio ide version first this is the reason if you using ide 1.5 then you cant use gradle version 3.0+.

Leave a Reply

Your email address will not be published. Required fields are marked *