gradle 无法解析com.android.tools.build:aapt 2:7.3.1-8691043

q9yhzks0  于 2022-11-14  发布在  Android
关注(0)|答案(1)|浏览(470)

当我创建新项目,项目运行成功,但之后,当我退出android工作室,并重新打开该项目出现此错误

Execution failed for task ':app:processDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform material-1.7.0.aar (com.google.android.material:material:1.7.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Could not isolate parameters com.android.build.gradle.internal.dependency.AarResourcesCompilerTransform$Parameters_Decorated@8d32791 of artifact transform AarResourcesCompilerTransform
         > Could not isolate value com.android.build.gradle.internal.dependency.AarResourcesCompilerTransform$Parameters_Decorated@8d32791 of type AarResourcesCompilerTransform.Parameters
            > Could not resolve all files for configuration ':app:detachedConfiguration2'.
               > Could not find com.android.tools.build:aapt2:7.3.1-8691043.
                 Searched in the following locations:
                   - https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/7.3.1-8691043/aapt2-7.3.1-8691043.pom
                   - https://repo.maven.apache.org/maven2/com/android/tools/build/aapt2/7.3.1-8691043/aapt2-7.3.1-8691043.pom
                 Required by:
                     project :app
  • Android工作室海豚
  • 安卓gradle插件版本7.3.1
  • Gradle版本7.4
uelo1irk

uelo1irk1#

我的经历有点不同,但可能对你的情况有帮助。下面是我的环境:海豚patch 1,Gradle 7.3.1,最新的依赖项,Windows 11,Java 1_8。我的项目启动了,一切正常。然后我调整了一些代码,比如改变按钮的位置,再次运行时,我得到了aapt 2错误。我做了Build-〉Clean Project,再次运行,仍然得到了这个aapt 2错误。所以我关闭了项目,退出Studio,重新启动Windows,然后启动Studio,加载项目,并再次运行,它通过调试和启动,一切正常。我仍然不知道,虽然,为什么重新启动Windows修复aapt 2错误。我会留给开发团队找到答案,它可能与缓存或临时文件或什么....

相关问题