'How to fix "Gradle's dependency cache may be corrupt" error after updating android studio from 2.2.3 to 2.3?
> 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>
Solution 1:[1]
Find 'gradle-wrapper.properties' in root project
distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip
Change "https" to "http".
Solution 2:[2]
go to the "home.gradle\wrapper\dists" folder and cut/delete the "gradle-3.3-all" folder, now rebulid the project. This should resolve the issue, as it worked for me.
Solution 3:[3]
I face this problem after updating Android Studio from 2.2.3 to 2.3;
Solution
1) In your project open 'gradle-wrapper.properties', change the 'distributionUrl' value
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
2) In you project open the project's 'build.gradle' file, and change the classpath
classpath 'com.android.tools.build:gradle:2.3.0'
3) At last Sync your project.
(This is the latest gradle setting.)
Solution 4:[4]
If everything else fails, an option is to use a local distribution of gradle.
Download a zipped version of Gradle.
unzip it and place it in a directory. Preferably C:\Program Files\Android\Android Studio\gradle
As at time of writing, I am using gradle-3.4.1-bin
Then, direct gradle to this directory:
File > Settings > Gradle > use local gradle distribution
Sync your project and you are good to go.
Note: Although it is recommended to use the default gradle wrapper, this option is fine.The only "problem" is you have to manually track updates etc
Solution 5:[5]
Step 1 Go to your dir (cd ~) and do ls -la , It will show you .gradle folder. Do cd .gradle/wrapper/dists/gradle-3.3-all and check it premission
provide full permission
sudo chmod -R 777 .gradle/
it will provide full permision to .gradle folder
Step 2 delete the previous one
rm -rf .gradle/wrapper/dists/gradle-3.3-all/
Step 3 Use Restart and invalidate option of Android Studio it will clear previous cache and download fresh gradle-3.3-all file
step 4 Please keep your internet connection proper with good speed. it will download all required file. This issue gennerally comes when your internet connection is not stable or have slow sped. I am saying this as per error log given by AS. 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>
Solution 6:[6]
Just delete gradle folder , and let android studio download it again with click on Sync now !.
Solution 7:[7]
In order to solve it:
Go to gradle-wrapper.properties from the "project" side menu
Change:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.ziptodistributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip
After this studio should be able to download the correct zip file i.e. "gradle-3.3-all.zip".
If this does not help then you will have to make a few efforts:
- Download the zip file manually from gradle-3.3-all.zip
- Copy the zip file.
- Reach the directory wherever your ".gradle" folder exists. It's usually in "C:\Users\user.gradle", if you are on windows.
- Navigate to "wrapper" and then to "gradle-3.3-all".
- Replace the zip file already there with the newly downloaded zip file.
Solution 8:[8]
for mac user just go to the ~/.gradle/wrapper/dists and delete all the folders there
for more explanation follow the detail below
- open finder
- Go ->
Go to Folder - type
~/.gradle/wrapper/distsand press enter - delete all the folders in it
- now, restart android studio, it will download all the files again
Solution 9:[9]
this case appear to me when try to open another project that I download it from github so I just change all gradle files in all project to the latest gradle build
- build.gradle --> module app // compileSdkVersion and buildToolsVersion
- build.gradle --> project // classpath 'com.android.tools.build:gradle:currentVersion
- build.gradle --> library is exist.
- gradle-wrapper.properties --> be accurate to check the distributionUrl is start with https not http
all of this solve the problem for me ..
Solution 10:[10]
I faced the same issue 4 days ago and today I was able to solve it by changing the
Compile Sdk Version to 26
Target Sdk Version to 26
Min Sdk Version to 26
Build Tools Version to 28
by going to
File > Project Structure >
What did not work::
- deleting .gradle folder
- downloading gradle with Android studio
- downloading gradle manually
- Updating Android studio
Solution 11:[11]
I had different distributionUrl in two gradle-wrapper.properties inside my project
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow






