android - 无法解析配置“:app:_internal_aapt2_binary”的所有文件
问题描述
我在构建应用程序时收到此错误消息
FAILURE:构建失败并出现异常。
- 什么地方出了错:
任务 ':app:mergeDebugResources' 执行失败。
无法解析配置“:app:_internal_aapt2_binary”的所有文件。
org.gradle.api.GradleException:无法读取路径“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 文档,您将需要手动更改项目依赖项的位置。
脚步:
- 删除 buildScript
build.gradle
-> repositories 内(文件项目)中的 jCenter() 并添加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 }
同步项目
您可以在官方文档中找到有关此处的更多信息
推荐阅读
- html - 从 API 获取数据但没有数据显示在 html 中
- timestamp - 地址收到可靠令牌时的时间戳
- flutter - Flutter:在具有某种程度的全局可访问性的父 Widget 中的多个 Stateful Widget 的方法上需要一些帮助
- c++ - 通过 M1 芯片上的 Google 测试库编写单元测试时,未找到架构 arm64 的符号
- sql - CASTING to NUMERIC in SQL
- php - How To Send Cookies To A Website Through Laravel Panel Using PHP?
- javascript - 动态加载内容保留“在新选项卡中打开”功能
- web-services - 服务接入点连接
- javascript - call(force.drag)的含义
- c# - 如何返回任务
- > 来自 dapper 的“从表中选择 *”,而不必再次从第一个查询中查询结果 id?