Android Studio "Could not find com.android.tools.build:gradle:3.0.1"

I'm trying to build an Andoid Studio project and failing. I cloned the repo. from GitHub, including: build.gradle, gradle-wrapper.properties, gradle.properties, settings.gradle and local.properties.

When I try to build, the Build window shows:

Could not find com.android.tools.build:gradle:3.0.1.
Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
Required by:
    project :photo-crop-library
Open File

Note there is no 'just fix it' link in the above message. The text "Open File" is a link which, when clicked, opens build.gradle, which contains

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

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

That first classpath line used to contain classpath 'com.android.tools.build:gradle:3.0.1' but I followed the advice in Could not find com.android.tools.build.gradle:3.0.0-alpha7 to change to 3.2.1, but it didn't fix it.

Looking at the links in the error message, going to https://jcenter.bintray.com/com/android/tools/build/gradle, the highest version link shown on that page is 2.5.0-alpha-preview-02 so it looks like the link is wrong. I am a complete Android Studio newbie; how do I change that link? About Android Studio shows:

Android Studio 3.3
Build #AI-182.5107.16.33.5199772, built on December 25, 2018
JRE: 1.8.0_152-release-1248-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.18.5-gentoo.efi

Thanks in expectation of any help.

Upvotes: 0

Views: 1969

Answers (1)

Martin Zeitler
Martin Zeitler

Reputation: 76569

that error message does not match the provided build.gradle the least ...

because it originates from module :photo-crop-library, which has it's own build.gradle.

a) try updating to:

dependencies {
    classpath 'com.android.tools.build:gradle:3.3.0'
    classpath 'com.google.gms:google-services:4.2.0'
}

b) try to place repository google() in the line above jcenter().

Upvotes: 1

Related Questions