Android Studio gradle 2.1.3 issue - android

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.

Related

Where have google moved the latest gradle tool

For new android studio tool with following build script
repositories {
mavenLocal()
mavenCentral()
google()
jcenter()
}
// Switch the Android Gradle plugin version requirement depending on the
// installed version of Gradle. This dependency is documented at
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
// and https://issues.apache.org/jira/browse/CB-8143
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
}
}
I am getting following error.
A problem occurred evaluating root project 'android'.
Could not resolve all artifacts for configuration 'classpath'.
Could not find com.android.tools.build:gradle:4.0.1.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
Required by:
unspecified:unspecified:unspecified
There website shows that we need to add google in buildscript, which is right there.
https://developer.android.com/studio/releases/gradle-plugin

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.

Ionic project won't build (or run) after android plugin updated to 2.2.0

Error message:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
A problem occurred configuring project ':CordovaLib'.
Could not resolve all dependencies for configuration ':CordovaLib:classpath'.
Could not find com.android.tools.build:gradle:2.2.0.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.jar
Required by:
android:CordovaLib:unspecified
Remove platforms/android folder and add Android again:
ionic platform add android
buildscript {
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
}
add jcenter() to your repositories.
this worked for me.
A bit late but as the other answers didn't work hopefully this will help others
Update your Android CordovaLib to the latest version
https://cordova.apache.org/blog/
Find the latest version and run the command given
e.g. cordova platform update android#6.1.0
If this is not possible (or doesn't work) manually change the file
\platforms\android\CordovaLib\build.gradle and add in jcenter()
repositories {
mavenCentral()
jcenter()
}
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
}
try modifying these in your build.gradle . good luck

Could not find gradle 2.2.0-rc1

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'
}
}

Android Studio cannot find com.android.tools.build:grade:2.10

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()
}

Categories

Resources