Android Gradle 构建在缓存文件中失败

2022-09-02 03:36:23

我正在尝试构建我的一个Android库,每次我得到以下内容:

> Task :app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Multiple build operations failed.
      java.nio.file.NoSuchFileException: /Users/user/.gradle/caches/transforms-3/0d92c5dbe3682b4fd3af323bb8f4fc81/results.bin
      java.nio.file.NoSuchFileException: /Users/user/.gradle/caches/transforms-3/c9e81cc37c2c0c47883b955549c67149/results.bin
      java.nio.file.NoSuchFileException: /Users/user/.gradle/caches/transforms-3/a60e256c2ccb687ca2c3dc1173bab875/results.bin
      java.nio.file.NoSuchFileException: /Users/user/.gradle/caches/transforms-3/a31caec1a4d16ac05a41b0f552f96191/results.bin
      java.nio.file.NoSuchFileException: /Users/user/.gradle/caches/transforms-3/9d3aed6b3e5d40e0d4373af6f3e198dc/results.bin
      java.nio.file.NoSuchFileException: /Users/user/.gradle/caches/transforms-3/f9c01a9d9c0a59b69c3974ffcd3c9cee/results.bin
      java.nio.file.NoSuchFileException: /Users/user/.gradle/caches/transforms-3/4d9724e0450bfaa483db25a04db0eb48/results.bin
      java.nio.file.NoSuchFileException: /Users/user/.gradle/caches/transforms-3/a79286d8497b8365dabe35ac25780fe4/results.bin
      java.nio.file.NoSuchFileException: /Users/user/.gradle/caches/transforms-3/2896cf3b957b3724a2dcfcee68be211f/results.bin
      java.nio.file.NoSuchFileException: /Users/user/.gradle/caches/transforms-3/2896cf3b957b3724a2dcfcee68be211f/results.bin

大约还有200多行相同的

我已经从Android工作室尝试过,我已经尝试过,但我继续得到同样的错误。我能够在其他计算机上构建完全相同的库 - 我只是无法让它在一台机器上工作。我是否错过了其他可能导致这种情况的东西?Invalidate Cache and Restartrm -rf ~/.gradle/caches


答案 1

好吧,所以我终于设法让它工作...

不得不运行,而不是仅仅它,我想强迫它重新安装所有gradle的东西,然后构建工作rm -rf ~/.gradlerm -rf ~/.gradle/caches


答案 2

最好使用:

(Mac OS):

./gradlew cleanBuildCache

窗户:

gradlew cleanBuildCache

推荐