Gradle Build Failed in Android Studio (Cannot read testArtifacts.bin from cache)

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

  • Confused about testCompile and androidTestCompile in Android Gradle
  • Android geofencing API BroadcastReceiver not triggered
  • Emulator in Android Studio doesn't start
  • Inflate Exception in Google Map Fragment in ViewPager with TabLayout
  • Android - ImageView overlay another ImageView
  • How do I add a library project to the Android Studio and use it?(Some asked dont't take effect)
  • Related posts:

    IN clause and placeholders
    How to check if activity is in foreground or in visible background?
    Android app is published, but not visible anywhere in Google Play
    Reusing views in Android Listview with 2 different layouts
    Programmatically get theme colors
    irrlicht android on opengl es 2.0 driver
  • Minimum Hardware requirements for Android development
  • AutoCompleteTextView crops the last row
  • How to reference an external jar in an Android Library project in Eclipse
  • android http post asynctask
  • What is the fastest way to learn Android and quickly start developing apps?
  • Decoding bitmaps in Android with the right size
  • One Solution collect form web for “Gradle Build Failed in Android Studio (Cannot read testArtifacts.bin from cache)”

    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.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.