I'm attempting to update my gradle version within Android Studio. I am attempting to use version 2.10, but am running into issues.
Within my gradle-wrappers.properties I have
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
Inside my build.gradle file for my project I have
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.10'
}
}
allprojects {
repositories {
jcenter()
}
}
Within my Android Studio preferences, I do have Use default gradle wrapper selected. The errors I'm getting
4:04:01 PM Gradle sync failed: 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:
:MyApp:unspecified
Consult IDE log for more details (Help | Show Log)
I can see it's trying to find two files: gradle-2.10.pom and gradle-2.10.jar. Am I supposed to install those files manually?
Don't confuse the gradle plugin for android with the gradle version.
With this line you are declaring the gradle plugin. Use
classpath 'com.android.tools.build:gradle:2.0.0'
The gradle version is defined in gradle/wrapper/gradle-wrapper.properties. Use:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
To update the gradle wrapper you don't need to change the version of Android Plugin for Gradle.
The last version of com.android.tools.build:gradle is 2.0.0. Change your build.gradle like this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
}
}
allprojects {
repositories {
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.
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()
}
}
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
I am using Android studio 2.1.1 with gradle current version - 2.10.
I am trying to upgrade gradle version to 2.14.1, for which I have done the following:
In gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip
In build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.12'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Upon syncing, I get the following error:
Error:Could not find com.android.tools.build:gradle:2.14.1.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.jar
Required by:
:MultiPanePlayer:unspecified
My project-level settings has the following option "Use default gradle wrapper (recommended)" selected. Am I missing anything else ?
Issue Error with gradle plugin not getting updated resolved - If you are getting this error you should update the plugin version to 2.1.2 as #Henry has mentioned or 2.3.1. (Be careful it is 2.1.2 and not not 2.12). Here is the sample project level build.gradle that resolved my error-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
}
}
allprojects {
repositories {
jcenter()
}
}
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()
}