0
votes

I tried to build my Android project, but every time I try to I get this error:

Could not find com.android.tools.build:aapt2:3.2.1-4818971. Searched in the following locations: file:/C:/Users/Admin/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom file:/C:/Users/Admin/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-windows.jar file:/C:/Users/Admin/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom file:/C:/Users/Admin/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-windows.jar file:/C:/Users/Admin/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom file:/C:/Users/Admin/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-windows.jar https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-windows.jar Required by: project :app

What can I do to fix it?

2
Provide some minimal explanation, not only the error dump. How your config looks like, steps to get to that point...Alex.U

2 Answers

1
votes

You are missing out google() on your buildscript and allprojects Just add the following:

buildscript {
    repositories {
        google() 
        // Your other repositories
    }
 }

allprojects {
    repositories {
        google()
        // Your other repositories
    }
}

Then rebuild your project.

1
votes

In my case, i have just changed google() position inside build.gradle like this :

allprojects {
repositories {
    google()
    jcenter()
}