Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle version 2.2 is required. Current version is 2.10

I am trying to use gradle build. It gives me error saying that

Failed to apply plugin [id 'com.android.library'] Gradle version 2.2 is required. Current version is 2.10. If using the gradle wrapper, try editing the distributionUrl in /home/sanjeewa/workspace/Android/UVCCamera/gradle/wrapper/gradle-wrapper.properties to gradle-2.2-all.zip

But my gradle-wrapper.properties includes gradle-2.4-all.zip. I have changed it to gradle-2.2-all.zip Still same problem.

When I run gradle -version in terminal Gradle 2.10 shows as version.

How to solve that error??

my build gradle file is

 buildscript {     repositories {         jcenter()     }     dependencies {         classpath 'com.android.tools.build:gradle:1.3.0'     }   }    allprojects {     repositories {         jcenter()     }   }  
like image 785
manitaz Avatar asked Jan 12 '16 16:01

manitaz


People also ask

How do I specify the Gradle version?

You can specify the Gradle version in either the File > Project Structure > Project menu in Android Studio, or update your Gradle version using the command line.

What is the Gradle version of JDK 17?

The first Gradle version that officially supports Java 17 is version 7.3.


2 Answers

  1. Open gradle-wrapper.properties
  2. Change this line:

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

with

        distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip 
  1. Go to build.gradle (Project: your_app_name)
  2. Change this line

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

to this

     classpath 'com.android.tools.build:gradle:2.0.0-alpha3' 

or

     classpath 'com.android.tools.build:gradle:1.5.0' 
  1. Don't click Sync Now
  2. From menu choose File -> Invalidate Caches/Restart...
  3. Choose first option: Invalidate and Restart

Android Studio would restart. After this, it should work normally

Hope it help

like image 119
piotrek1543 Avatar answered Sep 18 '22 11:09

piotrek1543


Current work around is to overrideVersionCheck: In your build.gradle

buildscript {  System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'      ... } 

Check this link for more Details

like image 29
testsingh Avatar answered Sep 18 '22 11:09

testsingh