javaandroidgradle

Android Gradle build fails from cached files


I am trying to build one of my android libraries and everytime I get the following:

> 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

with about 200 more lines of the same

I've tried Invalidate Cache and Restart from android studio and I've tried rm -rf ~/.gradle/caches but I continue getting the same error. I am able to build the exact same library on my other computers - I just can't get it to work on one machine in particular. Is there any other thing I might be missing that could cause this?


Solution

  • Okay so I finally managed to get it to work...

    Had to run rm -rf ~/.gradle instead of just rm -rf ~/.gradle/caches which I guess forced it to reinstall all the gradle things and then the build worked