Could not find com.android.tools.build.gradle:3.0.0-alpha7 - android

I update the gradle plugin to the latest, and i'm getting this error:
Error:Could not find com.android.tools.build.gradle:3.0.0-alpha7:.
Searched in the following locations:
file:/C:/Users/dmin/Documents/android-studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha7//3.0.0-alpha7-.pom
file:/C:/Users/dmin/Documents/android-studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha7//3.0.0-alpha7-.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha7//3.0.0-alpha7-.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha7//3.0.0-alpha7-.jar
https://maven.google.com/com/android/tools/build/gradle/3.0.0-alpha7//3.0.0-alpha7-.pom
https://maven.google.com/com/android/tools/build/gradle/3.0.0-alpha7//3.0.0-alpha7-.jar
Here's my build.gradle
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build.gradle:3.0.0-alpha7'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Where i'm getting wrong? since i modified my gradle.build according to the question Could not find com.android.tools.build:gradle:3.0.0-alpha1 in circle ci
thank you!!
-- Updated the build.gradle according to Mr Tim, but i'm still having the same error
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build.gradle:3.0.0-alpha7'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}

Follow the steps in the 3.0.0 plugin migration guide
Update gradle version
The new Android plugin requires Gradle version 4.1-milestone-1 or
higher. If you're opening an existing project using Android Studio 3.0
Preview 5 or later, follow the prompts to automatically update an
existing project to the compatible version of Gradle.
To update Gradle manually, update the URL in gradle-wrapper.properties
as follows:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
and
Apply the plugin
If you're opening an existing project using Android
Studio 3.0 Preview 5 or later, follow the prompts to automatically
update your project to the latest version of the Android plugin. To
manually update your project, include the maven repo and change the
plugin version in your project-level build.gradle file as follows:
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1' //Minimum supported Gradle version is 4.6
}
}

You try :
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
Credits: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html

If you're in Android Studio 3.1 or higher, you're likely encounter such type of issue prompting by a Build window.
Simply click on the Add Google Maven repository and sync project option at right side and initiate another gradle sync.
It'll make the necessary changes in both gradle-wrapper.properties as well as build.gradle files.

Update gradle plugin : in gradle.properties file
add this line
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
then apply ther plugin in build.gradle file :
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}

the distributionUrl property inside gradle-wrapper.properties should be:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
that works for me

open the file path(just as the log said):
file:/C:/Users/dmin/Documents/android-studio/gradle/m2repository/com/android/tools/build/gradle/
found this file
just change classpath 'com.android.tools.build.gradle:3.0.0-alpha7'
to classpath 'com.android.tools.build.gradle:* * * ' ; * * * is the exist gradle file;
this problem is because of gradle file do not found

Related

Gradle sync failed: Could not find method google() for arguments [] on repository container [duplicate]

/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

Could not find com.android.tools.build:gradle:5.4.1

I just turned on an old computer and am trying to access some code. After updating all of my Android Studio, JDK, and Downloading the latest Gradle I am having trouble building the project. I get this error ;
ERROR: Could not find com.android.tools.build:gradle:5.4.1.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/5.4.1/gradle-5.4.1.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/5.4.1/gradle-5.4.1.jar
Required by:
project :
Add Google Maven repository and sync project
Open File
I have dont this and this
Below is the content of build.gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:5.4.1'
}
}
Below is the content of wrapper file
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
in my settings I have toggled between default and setting my path manually. I have also attemted to add google() and MavenCentral() to the repositories
I just ant to build and run my app but it is saying no! haha help
Don't confuse gradle with the Android Gradle plugin.
classpath 'com.android.tools.build:gradle:5.4.1'
It is the Android Gradle plugin and 5.4.1 doesn't exist.
Use the latest stable release:
classpath 'com.android.tools.build:gradle:3.4.1'
Check the release notes for other versions.
If you open URL https://jcenter.bintray.com/com/android/tools/build/gradle, there is no 5.4.1.
For gradle version meanings, please check What is real Android Studio Gradle Version?.
For your case, you need to add google() repo in your buildscript closure and modify the android-gradle-plugin version to be 3.4.1
buildscript {
repositories {
google()// <-- add this.
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
And, also, probably, you need to update your allprojects closure as below:
allprojects {
repositories {
google()// <-- add this.
jcenter()
}
}
Edit #1
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
This is the wrapper configuration telling which gradle version to use for your android gradle plugin. It is NOT the plugin version.

gradle - Could not find method google() for arguments [] on repository container [duplicate]

/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

Downgrade Android Plugin in Android Studio

I've got two workstations with Android Studio installed. The first one is having version 2.3.3, but the other one is having version 3.0. Both of them are using Gradle 3.3. The problem that I am facing is that when I create an application on the 3.0 system and then transfer it to the 2.3.3 it doesn't want to build. I am receiving
Could not resolve all dependencies for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
I compared a build.gradle file created from the older version of Android Studio and from the newer version
3.0 version:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
2.3.3:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
repositories {
jcenter()
}
}
From the 3.0 version, I removed "google()", because it was also failing.
I am new to Android Development and I would really appreciate it if you can help me to solve my problem of using one project on both of the environments.
Could not resolve all dependencies for configuration ':classpath'. > Could not find com.android.tools.build:gradle:3.0.0. Searched in the following locations: https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
It happens because you are using the wrong repository.
If you want to use android plugin for gradle 3.x you have to use:
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
It requires also gradle v4.+ using in gradle/wrapper/gradle-wrapper.properties :
distributionUrl=\
https\://services.gradle.org/distributions/gradle-4.1-all.zip
If you are using Android Studio 2.x you have to change the repository google() with maven { url "https://maven.google.com" }
If you want to use the android plugin for gradle 2.3.x you can use:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
and you can use gradle v.3.3 with:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Of course in this case you can't use the new DSL introduced with gradle v.4.x and the plugin 3.x for example the implementation() and api() DSL.
Android plugin 3.0 located in Google Maven Repository (google() line) and it requires new Gradle. You should update Gradle to version 4.1.
Open file gradle/wrapper/gradle-wrapper.properties and set
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
If you are using android studio <3.0 then go to gradle-wrapper.properties and change the gradle from 4.1 to 3.3.
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Go to top level gradle and change the gradle version from 3.0.0 to 2.3.3 and then it should work fine.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
If you are using android studio >3.0 then Go to gradle-wrapper.properties and change the gradle to 4.1.
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Go to top level gradle and change the gradle version from 3.0.0 and then it should work fine.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}

Error:(6, 0) Gradle DSL method not found: 'google()'

/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

Categories

Resources