在Android Studio 3.2.1升级后构建错误
作者:互联网
我正在从Udacity建立一个示例项目.到目前为止工作正常,但升级到Android Studio 3.2.1后,我面临下面的构建错误.
Gradle版本:4.6
项目链接:https://github.com/udacity/ud851-Sunshine/tree/student/S02.02-Solution-Menus
Could not find com.android.tools.build:aapt2:3.2.1-4818971**. Searched in the following locations:
file:/C:/Users/sandeepk2/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom
file:/C:/Users/sandeepk2/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/sandeepk2/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/sandeepk2/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/sandeepk2/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/sandeepk2/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
我该如何解决?
解决方法:
适用于Android Studio 3.2.1更新
只需在根级build.gradle中添加google()即可
buildscript {
repositories {
google() // <--here
jcenter()
}
}
allprojects {
repositories {
google() // <-- here
jcenter()
}
}
并看到魔术 – 错误消失了.
标签:android,android-gradle,android-studio,jcenter,android-build 来源: https://codeday.me/bug/20190918/1810656.html