bsky
bsky

Reputation: 20222

Old version of gradle is required error

I had a three year old Android Studio which I just upgraded to the latest version(3.2).

I opened a project and tried to run it, but I got this error:

Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly.

Then, I saw this in gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip

From what I understand Gradle 2.2 is not compatible with Android Studio 3.2.

distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip

Now however, if I try building again, I get this error:

Gradle version 2.2 is required. Current version is 4.9.

Why does it ask me for an old version of Gradle?

Upvotes: 0

Views: 763

Answers (2)

shizhen
shizhen

Reputation: 12583

There are TWO places to be aware of:

  • Android Gradle Plugin version.
  • Android wrapper version and Gradle version

Each version of Android Gradle Plugin version requires a minimum version of gradle version. For your case, it looks these two versions are not in sync. So, try to modify your files as below:

  1. Top level build.gradle

    buildscript {
        repositories {
            ...
        }
        dependencies {
            // This is the Android Gradle Plugin version
            classpath 'com.android.tools.build:gradle:3.1.3'
        }
    }
    
  2. gradle-wrapper.properties

    distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
    

Upvotes: 2

Farshid Ahmadi
Farshid Ahmadi

Reputation: 513

Android studio doesn't support that version unfortunately. My advice is using 4.4, that's last full supported version.

Upvotes: 0

Related Questions