Skip to content Skip to sidebar Skip to footer

Why Am I Getting "could Not Find Com.android.tools.build:gradle" Error?

This is based off my last question as well. Following this tutorial, I cloned the project into my machine and am trying to get the project to build properly. In the process of fix

Solution 1:

You are confusing between android gradle plugin and gradle version.

This classpath 'com.android.tools.build:gradle:1.2.3' is a gradle plugin for Android and as of this time, 1.2.3 is the latest.

The gradle version itself is in gradle-wrapper.properties file. 2.4 is the latest version,

Solution 2:

you can find last version in this address : repo1.maven.org/maven2/com/android/tools/build/gradlejcenter.bintray.com/com/android/tools/build/gradle

buildscript {
repositories {
    maven { url "https://jcenter.bintray.com" }
    maven { url "http://repo1.maven.org/maven2" }
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.0'
}
}

allprojects {
repositories {
    maven { url "https://jitpack.io" }
    maven { url "https://jcenter.bintray.com" }
    maven { url "http://repo1.maven.org/maven2" }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

Solution 3:

Per @Hamidreza's answer, check the maven and jcenter repos. Indeed jcenter (currently) has newer tools than maven.

So in the top-level build.gradle file, change "mavenCentral" to "jcenter" like this

repositories {
    //mavenCentral()jcenter()
}

Solution 4:

I fixed this exact issue by upgrading my version of Android Studio. I was receiving an error Could not find com.android.tools.build:gradle:2.2.0, and was running a 2.1.x version of Studio at the time.

A simple upgrade to 2.2.2 immediately fixed my issue. Hope this can help somebody!

Solution 5:

If you're behind a proxy, make sure Android Studio is set up for that. It does NOT assume system proxy settings.

My copy of Studio + Gradle wasn't set up to go through the proxy, and as a result it was giving me this error. Would've been nice to get a clear "hey buddy, I can't hit the web", but I got this error instead.

Post a Comment for "Why Am I Getting "could Not Find Com.android.tools.build:gradle" Error?"