7

build.gradle is as below

   dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'

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

Error is as below:

ERROR: Gradle version 2.2 is required. Current version is 5.1.1.

Please fix the project's Gradle settings. Fix Gradle wrapper and re-import project Open Gradle wrapper properties Gradle settings

Community
  • 1
  • 1
Zahid Hussain
  • 107
  • 1
  • 1
  • 9
  • see [What are Android Gradle Versions](https://stackoverflow.com/questions/51391708/what-is-real-android-studio-gradle-version/51392464#51392464) for more details. – shizhen Jul 13 '19 at 11:14

3 Answers3

16

The android gradle plugin and the gradle version are linked. Here you can find all info:

Plugin version  Required Gradle version
1.0.0 - 1.1.3   2.2.1 - 2.3
1.2.0 - 1.3.1   2.2.1 - 2.9
1.5.0           2.2.1 - 2.13
2.0.0 - 2.1.2   2.10 - 2.13
2.1.3 - 2.2.3   2.14.1+
2.3.0+          3.3+
3.0.0+          4.1+
3.1.0+          4.4+
3.2.0 - 3.2.1   4.6+
3.3.0 - 3.3.2   4.10.1+
3.4.0+          5.1.1+

Use in your build.gradle

dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
    }

and in the gradle-wrapper.properties file

distributionUrl = https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
1

You can try to change the gradle plugin version in your project level build.gradle file to 2.2.0:

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

and then Invalidate and Restart Android studio.

bart
  • 1,003
  • 11
  • 24
0

Check the version of Gradle in Terminal

gradle --version

if this is version 5.1.1 u have to set system environment variable to gradle 2.2.0

or check

gradlew --version

if this is version 5.1.1 it is enough to set

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

in your project level build.gradle

Artur Gniewowski
  • 470
  • 7
  • 17