Having resolved an error thanks to tihs 'Gradle Version 2.10 is required' post. I'm not getting a new error.
I've been trying to follow answers like this one but nothing I try seems to work. I wonder if this is because I'm on a later version of gradle and Android Studio. I'm still getting this error in Android Studio
Error:Could not find com.android.tools.build:gradle:2.10.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.10/gradle-2.10.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.10/gradle-2.10.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/2.10/gradle-2.10.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/2.10/gradle-2.10.jar
Required by:
:android:unspecified
I've updated my build.gradle file to include:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.10'
}
}
And gradle-wrapper.properties to
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-2.10-all.zip
I'm at a loss of what to try next. This is app build on the Ionic framework (using cordova). the ionic build android command results in the same error too.
I'm using a Mac and Android Studio 2.1
Change
classpath 'com.android.tools.build:gradle:2.10'
to
classpath 'com.android.tools.build:gradle:2.1.0'
there is no version : 2.10 in gradle for Android Studio change it to:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
new answer :
please try to update gradle-wrapper.properties :
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
then in project build.gradle use this version:
classpath 'com.android.tools.build:gradle:1.5.0'
From menu: choose File -> Invalidate Caches/Restart... >> Invalidate and Restart
Gradle 2.x is not available in the maven repository, so you have to provide other repos to satisfy all your dependencies, in settings.gradle:
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
Related
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.
/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
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
After updating to Android Studio 2.2 RC, it asked me to update gradle plugin to 2.2.0-rc1. When I update I get the following error:
Error:Could not find com.android.tools.build:gradle:2.2.0-rc1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0-rc1/gradle-2.2.0-rc1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0-rc1/gradle-2.2.0-rc1.jar
Required by:
:my_project:unspecified
Any clues on how I may fix it?
According to: https://code.google.com/p/android/issues/detail?id=221529
The problem is already fixed (exactly: hour ago). Just for sure rebuild your project.
Replace jcenter() instead of mavenCentral() in your project level build.gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
}
Gradle Issue in Android Studio 2.1.3
I got those errors when i run the Desktop application that i've created based on the Tutorial.
where i can find that Gradle 2.1.3? Please help me. Im using Libgdx framework. Thank you in advance.
Error:Gradle: A problem occurred configuring root project 'Flapp Bird'.
Could not resolve all dependencies for configuration ':classpath'.
Could not find com.android.tools.build:gradle:2.1.3.
Searched in the following locations:
file:/C:/Users/Unknown/.m2/repository/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.pom
file:/C:/Users/Unknown/.m2/repository/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.jar
https:://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.
https:://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.jar
https:://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.pom
https:://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.jar
Required by:
:Flapp Bird:unspecified
The Gradle version 2.1.3 exists, but is not in the Maven central, as said here.
To fix the issue, just add jcenter() after mavenCentral() in your build script.
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
No, Ivan is right. The latest version of Android Studio insists on upgrading to Android Plugin for Gradle, Revision 2.1.3 (August 2016), Gradle 2.14.1 or higher and Build Tools 23.0.2 or higher.
But the moment it does that, it breaks compilation with that error:
Could not resolve all dependencies for configuration ':classpath'. Could not find com.android.tools.build:gradle:2.1.3. Searched in the following locations:
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.7.3'
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
For me adding this: classpath 'com.android.tools.build:gradle-experimental:0.7.3' did the trick.
AFAIK, the latest version of Gradle is 2.1.2. You might be confusing the gradle version with the gradle plugin. A similar question to yours was also answered over here Just change 'com.android.tools.build:gradle:2.1.3' to 2.1.2and you should be set.