-->

Gradle build failed - unable to unzip

2020-06-16 05:42发布

问题:

I am doing a project using android studio.Recently it showed an error that your SDK is missing or out of date so, I downloaded SDK once again.Now it shows an error that Gradle Build failed

The error is mentioned below:

`Error:Execution failed for task ':app:prepareComAndroidSupportAnimatedVectorDrawable2531Library'.
> Unable to unzip '/home/nandha/Android/Sdk/extras/android/m2repository/com/android/support/animated-vector-drawable/25.3.1/animated-vector-drawable-25.3.1.aar' to '/home/nandha/.android/build-cache/e07f150905e44f35b3635185e8f46be2d475fc86/output' or find the cached output '/home/nandha/.android/build-cache/e07f150905e44f35b3635185e8f46be2d475fc86/output' using the build cache at '/home/nandha/.android/build-cache'.
  To troubleshoot the issue or learn how to disable the build cache, go to https://d.android.com/r/tools/build-cache.html.
  If you are unable to fix the issue, please file a bug at https://d.android.com/studio/report-bugs.html.

Kindly help me to fix this error.

回答1:

You need the clear the build cache. Select View > Tool Windows > Terminal from the menu bar and use one of the following commands:

On Windows: gradlew cleanBuildCache



回答2:

I had the same problem, The answer is there : https://developer.android.com/studio/build/build-cache.html?utm_source=android-studio#clear_the_build_cache

You have just to do in a Terminal (for have terminal : Select View > Tool Windows > Terminal) :

On Windows:

gradlew cleanBuildCache

On Mac or Linux:

./gradlew cleanBuildCache

And build Gradle