我在构建应用程序时收到此错误消息
FAILURE: Build failed with an exception.
Execution failed for task ':app:mergeDebugResources'.
Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
org.gradle.api.GradleException: Could not read path 'C:\Users\Abdullah.gradle\caches\transforms-2\files-2.1\322973851a21411e089a9e85629c04f5\aapt2-3.4.0-5326820-windows'.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("windows")) {
buildDir = "C:/tmp/${rootProject.name}/${project.name}"
}
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
最佳答案
看起来您正在使用 jCenter() 存储库。
根据官方 google 文档,您将需要手动更改项目依赖项的位置。
脚步:
build.gradle
中的 jCenter() (file project) 在 buildScript -> repositories 中添加 mavenCentral()
构建脚本
repositories {
google()
mavenCentral() // New line
jcenter() //remove that line
}
allprojects
中做同样的事情 repositories {
google()
mavenCentral() // New line
jcenter() //remove that line
// NOTE: Keep any other entries you may have had here
}
您可以在 official documentation 上找到更多信息。
关于android - 无法解析配置 ':app:_internal_aapt2_binary' 的所有文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55790995/