James
James

Reputation: 818

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

Upvotes: 2

Views: 3594

Answers (3)

marcozabo
marcozabo

Reputation: 182

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

Upvotes: 0

Mounir Elfassi
Mounir Elfassi

Reputation: 2252

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

Upvotes: 1

JacksonWeekes
JacksonWeekes

Reputation: 312

Change

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

to

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

Upvotes: 1

Related Questions