22

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 :(

Vaibhav Singh
  • 1,554
  • 3
  • 13
  • 27

7 Answers7

16

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

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • After changing your suggestions, Now I am getting `GradleError:(25, 0) Gradle DSL method not found: 'implementation()'` – Vaibhav Singh Aug 04 '17 at 18:23
  • 1
    @VaibhavSingh: That project relies upon the newer Gradle and Android Plugin for Gradle, so fixing up the project is not going to be easy. Either use Android Studio 3.0 or follow Oleg's recommendation of using an older version of that app, before the change to require these newer tools. – CommonsWare Aug 04 '17 at 18:27
16

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)

Oleg Filimonov
  • 1,323
  • 4
  • 13
  • 36
  • I tried the second solution but it didn't work it still searching for gradle build 3.0, the Only solution left is to use Android Studio 3.0 – Vaibhav Singh Aug 04 '17 at 19:17
  • @VaibhavSingh I think the problem is that you are trying to revert to the commit where the update happened, not before it. Please make sure you're reverting to *before* the commit that I've linked to – Oleg Filimonov Aug 04 '17 at 20:49
  • Updating Studio fixed my problem. – Varshaan Oct 15 '18 at 14:38
8

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.

younes
  • 742
  • 7
  • 8
7

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'

}

Rahul_Pawar
  • 572
  • 1
  • 8
  • 16
6

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.

Henu
  • 1,622
  • 2
  • 22
  • 27
2

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

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+.