我最近将android studio更新为3.2,现在在构建时出现此错误:
Could not find com.android.tools.build:aapt2:3.2.0-4818971.
Searched in the following locations:
file:/C:/Users/me/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/C:/Users/me/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
file:/C:/Users/me/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/C:/Users/me/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
file:/C:/Users/me/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/C:/Users/me/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
file:/C:/Users/me/.m2/repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/C:/Users/me/.m2/repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
https://repo.maven.apache.org/maven2/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
https://repo.maven.apache.org/maven2/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
https://oss.sonatype.org/content/repositories/releases/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
https://oss.sonatype.org/content/repositories/releases/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
Required by:
project :android
这是什么?以及如何解决?
答案 0 :(得分:5)
添加google()
做您的build.gradle文件:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
答案 1 :(得分:0)
下面解决了我的问题,在jar文件夹下有3个文件夹,其中一个文件夹包含aapt2.exe。我将该文件复制到其他出现错误的文件夹中。
ex:jar的路径:C:\Users\umabhavania\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar
错误路径:C:\Users\umabhavania\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\a57a698502c21bfe8cfc3ed6eb102b39\aapt2-3.2.1-4818971-windows
从aapt2.exe
复制了57f15fb82085ec9389484ff7e041344f folder to a57a698502c21bfe8cfc3ed6eb102b39
文件
希望这会有所帮助。