2

I'm trying to build an Android project but the following error occurred

Error:(10, 1) A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
   > Gradle version 2.8 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in C:\Users\...\gradle\wrapper\gradle-wrapper.properties to gradle-2.8-all.zip

It seem something's wrong with the Gradle version, however I checked the gradle-wrapper-property and it's already 2.10.

Also in File-Project Structure-Project, gradle-version is also 2.10

No idea how this happened, I've also restarted android-studio many times.

piotrek1543
  • 19,130
  • 7
  • 81
  • 94
Edward
  • 161
  • 1
  • 1
  • 12

5 Answers5

10

For those that still need help, an answer on another post did it for me link.

You need to change Settings > Builds,Execution,Deployment > Build Tools > Gradle >Gradle home path

Or set Use default gradle wrapper and edit Project\gradle\wrapper\gradle-wrapper.properties files field distributionUrl like this

distributionUrl=https://services.gradle.org/distributions/gradle-2.10-all.zip
Community
  • 1
  • 1
Ahmed Libadri
  • 101
  • 1
  • 4
  • 1
    Change "Settings > Builds,Execution,Deployment > Build Tools > Gradle >Gradle" works. I've tried changing "gradle-wrapper.properties", then doing File -> Invalidate Caches/Restart -> Invalidate and Restart, but the problem persist. – Chlind Mar 22 '16 at 05:51
1

I don't think that changing Gradle tools to version 1.5.0 is necessary, but if you're using 2.0-snapshot or beta version of gradle, I recommend you to change it to 1.5.0.

This error:

Error:(10, 1) A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
   > Gradle version 2.8 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in

C:\Users...\gradle\wrapper\gradle-wrapper.properties to gradle-2.8-all.zip

only tells you that your project's Gradle system is a bit outdated and need to be updated to newer version.

Open your project Android Studio and in navigator on the left find file called gradle-wrapper.properties. It should have a content like this:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

Change the last line with distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip

It should work.

piotrek1543
  • 19,130
  • 7
  • 81
  • 94
1

Go To Android Preference and Just change Project level Settings to Use default gradle wrapper (recommended).

Wasim
  • 921
  • 12
  • 14
0

There is a bug in version checking in older android plugins. To fix this you can either go back to gradle 2.9 or use the newer plugin

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

But I see from your error message that it tries to run with gradle 2.4 so this is maybe another problem.

Henry
  • 42,982
  • 7
  • 68
  • 84
  • I tried to change to this but it says cannot find gradle:1.5.0 I then try to update android-studio from 1.4 to 1.5.1. It worked – Edward Jan 05 '16 at 08:18
0

Updating the version of android studio from 1.4 to 1.5.1 fixed this problem for me.

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
Edward
  • 161
  • 1
  • 1
  • 12