Build Failed with an Exception in Android Studio – Gradle Metadata Error

If you're encountering the following error during build in Android Studio:

FAILURE: Build failed with an exception. * What went wrong: Multiple build operations failed. Could not read workspace metadata from C:\Users\abc\.gradle\caches\transforms-4\488376c3749de4c34a681b5fd5a06aa8\metadata.bin Could not read workspace metadata from C:\Users\abc\.gradle\caches\transforms-4\e2dc2f44e335b5e104801cc73d245ee1\metadata.bin

This usually indicates corrupted Gradle cache files.

How to Fix:

Step 1: Open the Terminal in Android Studio (or use Command Prompt).
Step 2: Navigate to the Gradle directory:

cd C:\Users\<YourUsername>\.gradle\

Step 3: Remove the corrupted caches folder:

bash

rm -r caches\

On Windows, if using Command Prompt instead of terminal, use:

rmdir /s /q caches

Step 4: Go back to Android Studio and click Build > Clean Project or Rebuild Project.

This should resolve the issue and allow your project to build successfully.

← Back to Home

Comments

Post a Comment