Could not find com.android.tools.build:aapt2:3.2.1-4818971.

Android Studio升级到3.2.1后,运行项目报如下错:

Could not find com.android.tools.build:aapt2:3.2.1-4818971.
Searched in the following locations:
    file:/D:/AndroidStudio/sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom
    file:/D:/AndroidStudio/sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-windows.jar
    file:/D:/AndroidStudio/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom
    file:/D:/AndroidStudio/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-windows.jar
    file:/D:/AndroidStudio/sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom
    file:/D:/AndroidStudio/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
 

解决方法很简单:

在项目的build.gradle文件中,新增一行google()即可解决

allprojects {
    repositories {
        jcenter()
        google()//新增这一行
    }
}

你可能感兴趣的:(Android,Studio,Android)