When generating the APK I'm getting the error: The project is using an unsupported version of gradle. I'm working with Android Studio 3.5 version.
I've tried to change build gradle classpath to match distributionUrl in gradle-wrapper.properties but the error persists.
First, in Project-level settings, Use default gadle wrapper is selected.
Build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Gradle-wrapper file:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
The project is using an unsupported version of Gradle.
Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.)
from the look of things you're using a very old version of gradle which might have been depreciated, an upgrade of gradle could solve this issueclasspath 'com.android.tools.build:gradle:3.4.2' and distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
Related
/Users/Ren/Desktop/RecylerViewBaseAdapter/build.gradle
Error:(6, 0) Gradle DSL method not found: 'google()'
Possible causes:
The project 'RecylerViewBaseAdapter' may be using a version of Gradle that does not contain the method.
Gradle settings
The build file may be missing a Gradle plugin.
Apply Gradle plugin
The google() repo is a shortcut to look in Google's Maven repository for dependencies. It was introduced with gradle v.4.0.
It requires (currently)
Gradle v.4
Android Studio 3.x.
Gradle plugin for Android 3.x
Try to use in gradle-wrapper.properties use:
distributionUrl=\
https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip
As gradle plugin for Android use:
classpath 'com.android.tools.build:gradle:3.0.0-beta1'
In any case (also with Android Studio 2.3, gradle plugin 2.3.3 and gradle v3.3) you can use the same maven repo using { url 'https://maven.google.com'}. It is the same.
Just use for example:
buildscript {
repositories {
maven {
url 'https://maven.google.com'
}
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
//
}
If you use Android studio 2.3.3, then try adding this in your project level gradle
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
this worked for me.
You also can use google() instead but you need Gradle 4.x+, Android Studio 3.x+ , Gradle plugin 3.x+
Just change gradle-wrapper.properties file (below image)
To this (if your gradle is com.android.tools.build:gradle:3.0.1)
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip // this version or above|
For gradle
com.android.tools.build:gradle:3.2.1
Use this
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
UPDATE
For following gradles
//# 1
com.android.tools.build:gradle:3.0.1
//# 2
com.android.tools.build:gradle:3.1.0
//# 3
com.android.tools.build:gradle:3.2.1 //or 3.2.0
//# 4
com.android.tools.build:gradle:3.3.2 //or 3.3.0
//# 5
com.android.tools.build:gradle:3.4.0
//# 6
com.android.tools.build:gradle:3.5.0
//# 7
com.android.tools.build:gradle:4.0.1
Use following urls
//# 1
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
//# 2
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
//# 3
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
//# 4
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
//# 5
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
//# 6
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
//# 7
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Don't forget adding google() in buildscript repositories.
Looks like you're using a version of Gradle lower than 4.1
Solution 1:
Change the distribution URL in your gradle-wrapper.properties as follows:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip
To locate the gradle-wrapper.properties file, press ctrl + shift + N in Android Studio and type gradle-wrapper
Change the dependencies as follows:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Solution 2:
Use following in your repositories{...} blocks instead of google():
maven {
url 'https://maven.google.com'
// An alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
change your project level gradle file with this,
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
My mistake was fixed after changing the order of elements:
Before:
jcenter()
google()
After:
google()
jcenter()
I use the following settings now.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3' // put here an actual version
classpath 'com.google.gms:google-services:3.3.0' // put here an actual version
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
Accourding to
Android gradle plugin release
So for example if you use plugin version 3.2.1 in:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
You must change the gradle version in
gradle-wrapper.properties
To
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Goodluck
In my case, I was getting this error due to the lower version on System Gradle than Android Gradle.
System Gradle version lower than Android Gradle version 4.4.
Issue solved after I updated System(Ubuntu machine) Gradle version.
Please use
dependencies { classpath 'com.android.tools.build:gradle:3.2.0' }
inside build.gradle
&
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip inside gradle-wrapper.properties
Download Gladle v4.7 from this link:
services.gradle.org/distributions/gradle-4.7-all.zip
Extact all content package to path:
C:\Users\SESSION_NAME.gradle\wrapper\dists
Go to Gradle then 'Gradle Settings'
Choose 'Use local gradle distribution' and enter the path of extracted content
C:\Users\Ahmed.gradle\wrapper\dists\gradle-4.7-all\gradle-4.7 & save changes 'apply'
Finaly Rebuild Project in Build menu
Change the distribution URL in your gradle-wrapper.properties as follows:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
/Users/Ren/Desktop/RecylerViewBaseAdapter/build.gradle
Error:(6, 0) Gradle DSL method not found: 'google()'
Possible causes:
The project 'RecylerViewBaseAdapter' may be using a version of Gradle that does not contain the method.
Gradle settings
The build file may be missing a Gradle plugin.
Apply Gradle plugin
The google() repo is a shortcut to look in Google's Maven repository for dependencies. It was introduced with gradle v.4.0.
It requires (currently)
Gradle v.4
Android Studio 3.x.
Gradle plugin for Android 3.x
Try to use in gradle-wrapper.properties use:
distributionUrl=\
https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip
As gradle plugin for Android use:
classpath 'com.android.tools.build:gradle:3.0.0-beta1'
In any case (also with Android Studio 2.3, gradle plugin 2.3.3 and gradle v3.3) you can use the same maven repo using { url 'https://maven.google.com'}. It is the same.
Just use for example:
buildscript {
repositories {
maven {
url 'https://maven.google.com'
}
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
//
}
If you use Android studio 2.3.3, then try adding this in your project level gradle
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
this worked for me.
You also can use google() instead but you need Gradle 4.x+, Android Studio 3.x+ , Gradle plugin 3.x+
Just change gradle-wrapper.properties file (below image)
To this (if your gradle is com.android.tools.build:gradle:3.0.1)
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip // this version or above|
For gradle
com.android.tools.build:gradle:3.2.1
Use this
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
UPDATE
For following gradles
//# 1
com.android.tools.build:gradle:3.0.1
//# 2
com.android.tools.build:gradle:3.1.0
//# 3
com.android.tools.build:gradle:3.2.1 //or 3.2.0
//# 4
com.android.tools.build:gradle:3.3.2 //or 3.3.0
//# 5
com.android.tools.build:gradle:3.4.0
//# 6
com.android.tools.build:gradle:3.5.0
//# 7
com.android.tools.build:gradle:4.0.1
Use following urls
//# 1
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
//# 2
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
//# 3
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
//# 4
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
//# 5
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
//# 6
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
//# 7
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Don't forget adding google() in buildscript repositories.
Looks like you're using a version of Gradle lower than 4.1
Solution 1:
Change the distribution URL in your gradle-wrapper.properties as follows:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip
To locate the gradle-wrapper.properties file, press ctrl + shift + N in Android Studio and type gradle-wrapper
Change the dependencies as follows:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Solution 2:
Use following in your repositories{...} blocks instead of google():
maven {
url 'https://maven.google.com'
// An alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
change your project level gradle file with this,
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
My mistake was fixed after changing the order of elements:
Before:
jcenter()
google()
After:
google()
jcenter()
I use the following settings now.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3' // put here an actual version
classpath 'com.google.gms:google-services:3.3.0' // put here an actual version
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
Accourding to
Android gradle plugin release
So for example if you use plugin version 3.2.1 in:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
You must change the gradle version in
gradle-wrapper.properties
To
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Goodluck
In my case, I was getting this error due to the lower version on System Gradle than Android Gradle.
System Gradle version lower than Android Gradle version 4.4.
Issue solved after I updated System(Ubuntu machine) Gradle version.
Please use
dependencies { classpath 'com.android.tools.build:gradle:3.2.0' }
inside build.gradle
&
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip inside gradle-wrapper.properties
Download Gladle v4.7 from this link:
services.gradle.org/distributions/gradle-4.7-all.zip
Extact all content package to path:
C:\Users\SESSION_NAME.gradle\wrapper\dists
Go to Gradle then 'Gradle Settings'
Choose 'Use local gradle distribution' and enter the path of extracted content
C:\Users\Ahmed.gradle\wrapper\dists\gradle-4.7-all\gradle-4.7 & save changes 'apply'
Finaly Rebuild Project in Build menu
Change the distribution URL in your gradle-wrapper.properties as follows:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
/Users/Ren/Desktop/RecylerViewBaseAdapter/build.gradle
Error:(6, 0) Gradle DSL method not found: 'google()'
Possible causes:
The project 'RecylerViewBaseAdapter' may be using a version of Gradle that does not contain the method.
Gradle settings
The build file may be missing a Gradle plugin.
Apply Gradle plugin
The google() repo is a shortcut to look in Google's Maven repository for dependencies. It was introduced with gradle v.4.0.
It requires (currently)
Gradle v.4
Android Studio 3.x.
Gradle plugin for Android 3.x
Try to use in gradle-wrapper.properties use:
distributionUrl=\
https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip
As gradle plugin for Android use:
classpath 'com.android.tools.build:gradle:3.0.0-beta1'
In any case (also with Android Studio 2.3, gradle plugin 2.3.3 and gradle v3.3) you can use the same maven repo using { url 'https://maven.google.com'}. It is the same.
Just use for example:
buildscript {
repositories {
maven {
url 'https://maven.google.com'
}
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
//
}
If you use Android studio 2.3.3, then try adding this in your project level gradle
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
this worked for me.
You also can use google() instead but you need Gradle 4.x+, Android Studio 3.x+ , Gradle plugin 3.x+
Just change gradle-wrapper.properties file (below image)
To this (if your gradle is com.android.tools.build:gradle:3.0.1)
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip // this version or above|
For gradle
com.android.tools.build:gradle:3.2.1
Use this
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
UPDATE
For following gradles
//# 1
com.android.tools.build:gradle:3.0.1
//# 2
com.android.tools.build:gradle:3.1.0
//# 3
com.android.tools.build:gradle:3.2.1 //or 3.2.0
//# 4
com.android.tools.build:gradle:3.3.2 //or 3.3.0
//# 5
com.android.tools.build:gradle:3.4.0
//# 6
com.android.tools.build:gradle:3.5.0
//# 7
com.android.tools.build:gradle:4.0.1
Use following urls
//# 1
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
//# 2
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
//# 3
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
//# 4
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
//# 5
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
//# 6
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
//# 7
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Don't forget adding google() in buildscript repositories.
Looks like you're using a version of Gradle lower than 4.1
Solution 1:
Change the distribution URL in your gradle-wrapper.properties as follows:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip
To locate the gradle-wrapper.properties file, press ctrl + shift + N in Android Studio and type gradle-wrapper
Change the dependencies as follows:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Solution 2:
Use following in your repositories{...} blocks instead of google():
maven {
url 'https://maven.google.com'
// An alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
change your project level gradle file with this,
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
My mistake was fixed after changing the order of elements:
Before:
jcenter()
google()
After:
google()
jcenter()
I use the following settings now.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3' // put here an actual version
classpath 'com.google.gms:google-services:3.3.0' // put here an actual version
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
Accourding to
Android gradle plugin release
So for example if you use plugin version 3.2.1 in:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
You must change the gradle version in
gradle-wrapper.properties
To
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Goodluck
In my case, I was getting this error due to the lower version on System Gradle than Android Gradle.
System Gradle version lower than Android Gradle version 4.4.
Issue solved after I updated System(Ubuntu machine) Gradle version.
Please use
dependencies { classpath 'com.android.tools.build:gradle:3.2.0' }
inside build.gradle
&
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip inside gradle-wrapper.properties
Download Gladle v4.7 from this link:
services.gradle.org/distributions/gradle-4.7-all.zip
Extact all content package to path:
C:\Users\SESSION_NAME.gradle\wrapper\dists
Go to Gradle then 'Gradle Settings'
Choose 'Use local gradle distribution' and enter the path of extracted content
C:\Users\Ahmed.gradle\wrapper\dists\gradle-4.7-all\gradle-4.7 & save changes 'apply'
Finaly Rebuild Project in Build menu
Change the distribution URL in your gradle-wrapper.properties as follows:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Issue. Every time we update android studio and tools we end up on a new version of the gradle pluging. The team has to manually update the build.gradle every time we switch branches.
Solution use gradle wrappers. However it is failing to work giving us this incompatible error. The wrapper in past experiences would download the version we want and just work. Why are we getting this incompatible version?
Most of us use canary channels for studio and tools. However we want the build.gradle to be the same for all of us and not to have to mess with it.
Specifically I do not want to have to update
classpath 'com.android.tools.build:gradle:2.2.0-alpha7'
I also want to avoid using something like gradle:2.2+ as the goal is to have everyone on the same set of tools.
Top most build.gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
task wrapper(type: Wrapper) {
gradleVersion = '2.2' //version required
// distributionUrl = distributionUrl.replace("bin", "all")
}
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-alpha7'
// Per https://github.com/JakeWharton/butterknife
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
My project at run time, there was a gradle version of the error, I tried a lot of ways are not resolved, we have not encountered a similar error, the following is the error log.
Error:(1, 0) Gradle DSL method not found: 'apply()' Possible
causes:The project 'xindatx1.6.0' may be using a version of the
Android Gradle plug-in that does not contain the method (e.g.
'testCompile' was added in 1.1.0). Fix plugin version and sync
projectThe project 'xindatx1.6.0' may be using a version of Gradle
that does not contain the method. Open Gradle wrapper fileThe build
file may be missing a Gradle plugin. Apply Gradle plugin
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.novoda:bintray-release:0.8.1'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' // add plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}