2

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

Community
  • 1
  • 1
James
  • 788
  • 2
  • 10
  • 28

3 Answers3

1

Change

classpath 'com.android.tools.build:gradle:2.10'

to

classpath 'com.android.tools.build:gradle:2.1.0'
JacksonWeekes
  • 312
  • 3
  • 11
  • Hi, thanks for the reply, but I'm still getting the same error. I tried changing the `distributionUrl` too, but that just gave a me a download error – James May 05 '16 at 11:27
1

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

Mounir Elfassi
  • 2,242
  • 3
  • 23
  • 38
  • Hi, thanks for the reply, but I'm still getting the same error. I tried changing the `distributionUrl` too, but that just gave a me a download error – James May 05 '16 at 11:27
  • please try my new answer, i didn't payed attention that you are using Ionic framework – Mounir Elfassi May 05 '16 at 11:37
  • If I lower the version I get a 'Gradle version 2.10 is required' error – James May 05 '16 at 12:53
0

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()
}
marcozabo
  • 174
  • 8