[android] Error:Failed to open zip file. Gradle's dependency cache may be corrupt

I updated android studio 2.3 and there is a bug, gradle doesn't build and it keeps giving me the same error for all projects.

Error:Failed to open zip file.
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a>
<a href="syncProject">Re-download dependencies and sync project (requires network)</a>

I have already searched for a solution, but have not found any. I tried:

Invalidate Caches / Restart...

but nothing has changed.

This question is related to android android-studio gradle error-handling sdk

The answer is


Android Studio 4.1.1 has this bug,

In gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

This won't download and always gives 'gradle cache corrupt' error, but a small change makes it work fine

distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

Now sync the gradle again and it's done.


1.Go to "/Users/****/.gradle/wrapper/dists/gradle-.-all/*****".

2.Delete the "gradle-.-all.zip.lck" file.

3.Invalidate Cache and Restart.


This was the best solution for me, just follow this path C:\Users\yourusername.gradle\wrapper\dists then delete all the files inside this folder. Close your android studio and restart it and it will automatically download the updated gradle files.


Go to "File" in android studio, Click "invalidate caches/Restart" and "Invalidate and Restart"

That also works


just remove and reDownload wrapper gradle.

Mac Home/.gradle/wrapper/dists/

remove gradle version and sync gradle in project and run project.

enter image description here


Taking a cue from @Mikel Yang, I found out that instead of deleting the ~/.gradle/wrapper/dists/ folder (which will means downloading the gradle files for different apps on my Android Studio), I decided to change the gradle.wrapper.properties file to any latest gradle --all.zip. So

Find 'gradle-wrapper.properties' in root project

distributionUrl=https\://services.gradle.org/distributions/gradle-{lastest}-all.zip

this way l get to save some data and time.


Repair Gradle Installation

This usually happens when something goes wrong in Android Studio's first launch (eg. system crash, connection loss or whatever).

To resolve this issue close Android Studio and delete the following directory's content, necessary files will be downloaded on IDE's next launch.

macOS: ~/.gradle/wrapper/dists

Linux: ~/.gradle/wrapper/dists

Windows: C:\Users\your-username\.gradle\wrapper\dists

While downloading Gradle manually works, I recommend letting Android Studio itself to do it.


you do not need to clean all files in dir C:\Users\ ~User Name~ \.gradle\wrapper\dists. and download all of them again

instead you can just delete the folder of gradle version you failed to download. In my case it was gradle-4.4-all so i just deleted that folder and android studio re downloaded gradle-4.4-all for me

In case you don't know version you was downloading:

Just go to help menu > show logs in explorer

their you will find idea.log open it and search for

Could not install Gradle distribution from 'https://services.gradle.org/distribution`

once you find it you will find gradle version you failed to download


Find 'gradle-wrapper.properties' in root project

distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

Change "https" to "http".


I faced the same issue 2 days ago and today I was able to solve it like this:

  1. Go to this path C:\Users\user_name\.gradle\wrapper\dists where user_name is your username if its you own PC or your company's name.

  2. Delete the latest gradle-****-all files since your latest update of android studio (ex. 2.3 or another version).

  3. If your android studio is open, close it then reopen it. A newer Gradle version will be downloaded, it will take time depending on your internet speed, the download size is around 150-200 MB before extraction so if android studio takes a long time to refresh just know its downloading. (To check the download progress right click on the new gradle folder, go to properties and check the size).


I faced the issue, In my understanding, It is because of invalid combination of Android Studio And Gradle Plugin versions. I was using Gradle version 5.4.1 and Studio version 3.4, hence I updated the Android studio to 3.5 and the issue got resolved


****Following solution is working for me**** Manually deleted all files from C:\Users\Admin.gradle\wrapper\dists\

where Admin is my user name


Go to Project pane> Android > Gradle Scripts and open "graddle-wrapper.properties" file check the distribution URL:

enter image description here

Go to your ".gradle/wrapper/dists/" folder and remove that file for me it was "gradle-5.6.4-all"

enter image description here

Then go back to android studio and click on File > Sync Project with Gradle Files. And it will start to download again

enter image description here


This happened to me because of a partially downloaded gradle distribution zip

  • To resolve simply go to below path

    "C:/Users/your_username/.gradle"

    OR

    pull your gradle path from File->Settings->Build, Exectution, Deployment-> Gradle -> gradle service directory path.

  • Delete the partially downloaded distribution gradle folder

  • Go to Studio (no need to restart) and perform gradle sync

You can delete the latest gradle-.-all folder from the below path Windows: C:\Users\your-username.gradle\wrapper\dists


I was upgrading gradle from 4.1 to 4.10 and my internet connection timed out.

So I fixed this issue by deleting "gradle-4.10-all" folder in .gradle/wrapper/dists


There are Following Steps to solve this issue.


1. Go to C:\Users\ ~User Name~ \.gradle\wrapper\dists.
2. Delete all the files and folders from dists folder.
3. If Android Studio is Opened then Close any opened project and Reopen the project. The Android Studio Will automatic download all the required files.


(The required time is as per your Internet Speed (Download Size will be about "89 MB"). To see the progress of the downloading Go to C:\Users\ ~User Name~ \.gradle\wrapper\dists folder and check the size of the folder.)


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to android-studio

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK

Examples related to gradle

Gradle - Move a folder from ABC to XYZ A failure occurred while executing com.android.build.gradle.internal.tasks Gradle: Could not determine java version from '11.0.2' Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 Failed to resolve: com.android.support:appcompat-v7:28.0 Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0)

Examples related to error-handling

must declare a named package eclipse because this compilation unit is associated to the named module Error:Failed to open zip file. Gradle's dependency cache may be corrupt What does 'index 0 is out of bounds for axis 0 with size 0' mean? What's the source of Error: getaddrinfo EAI_AGAIN? Error handling with try and catch in Laravel What does "Fatal error: Unexpectedly found nil while unwrapping an Optional value" mean? Raise error in a Bash script Javascript Uncaught TypeError: Cannot read property '0' of undefined Multiple values in single-value context IndexError: too many indices for array

Examples related to sdk

I am receiving warning in Facebook Application using PHP SDK Has been compiled by a more recent version of the Java Runtime (class file version 57.0) Difference between OpenJDK and Adoptium/AdoptOpenJDK Error:Failed to open zip file. Gradle's dependency cache may be corrupt Can't accept license agreement Android SDK Platform 24 Automatically accept all SDK licences Android SDK location should not contain whitespace, as this cause problems with NDK tools Android SDK folder taking a lot of disk space. Do we need to keep all of the System Images? "The following SDK components were not installed: sys-img-x86-addon-google_apis-google-22 and addon-google_apis-google-22" Can't find SDK folder inside Android studio path, and SDK manager not opening