Gradle Build Failed in Android Studio (Cannot read

2019-04-19 05:03发布

问题:

There is no error in the code. But the build fails with the following error:

Error:Could not read entry ':app:packageDebug' from cache taskArtifacts.bin (/Users/sibidharan/Developer/Android Dev/Karpagam/.gradle/2.10/taskArtifacts/taskArtifacts.bin).
> java.io.EOFException (no error message)

I am using Android Studio 2.0 Preview 9 on OS X 10.11.3

回答1:

Removing the project-local .gradle folder did it for me. It was then recreated during the next build and all was fine again.

UPDATE:

This answer helps.

Gradle cache locates at

  • On Windows: %USER_HOME%.gradle/caches
  • On Mac/Unix: $HOME/.gradle/caches/

You can browse to these directory and manually delete it or run

rm -rf $HOME/.gradle/caches/

on Unix or OS X system.