6

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.

enter image description here

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

Cœur
  • 37,241
  • 25
  • 195
  • 267
Ivan Arnie
  • 137
  • 2
  • 10

4 Answers4

21

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'
    }
}
manelizzard
  • 1,060
  • 8
  • 19
4

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. Studio Message 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: 
johncougar
  • 276
  • 2
  • 3
  • 10
1
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.

Vikas
  • 4,263
  • 1
  • 34
  • 39
0

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.

Community
  • 1
  • 1
S. Russ
  • 25
  • 5