richey
richey

Reputation: 3948

build.gradle dependency results in compile error

After a long time, I have updated my Android Studio environment to the latest versions, but now my project doesn't compile anymore.

The error message displayed says

Could not find com.android.tools.build:aapt2:3.4.2-5326820. Searched in the following locations: - https://jcenter.bintray.com/com/android/tools/build/aapt2/3.4.2-5326820/aapt2-3.4.2-5326820.pom - https://jcenter.bintray.com/com/android/tools/build/aapt2/3.4.2-5326820/aapt2-3.4.2-5326820-windows.jar Required by: project :app

The only reference there is to 3.4.2 is in build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:3.4.2'
}

but if I remove this, the project doesn't compile either.

Any hint on how I can resolve this?

Upvotes: 0

Views: 503

Answers (1)

Ovaflo
Ovaflo

Reputation: 684

I had the same problem and solved it by adding google() as a repository under allprojects in the build.gradle file:

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

Upvotes: 3

Related Questions