Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error after update......Gradle dependency cache may be corrupt

I updated my Android Studio from 2.2.3 to 2.3. Since then I am getting this

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 am unable to find a solution for it despite searching again & again

like image 389
Sameet Raza Avatar asked Dec 18 '22 09:12

Sameet Raza


1 Answers

This problem arises when android studio is not able to access the gradle.zip file. The easiest way to resolve this is to follow what studio tells you to do, in this case it says to re-download the dependencies. Due to a very minor glitch this doesn't work.

In order to solve it:

  1. Go to gradle-wrapper.properties from the "project" side menu
  2. Then change:

distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip to distributionUrl=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.

  1. Download the zip file manually from gradle-3.3-all.zip
  2. Copy the zip file.
  3. Reach the directory wherever your ".gradle" folder exists(It's usually in "C:\Users\user.gradle", if you are on windows).
  4. Then navigate to "wrapper" and then to "gradle-3.3-all".
  5. Replace the zip file already there with the newly downloaded zip file.

"Replace being the keyword here."

Sync your project. It may take time to sync, but it will definitely sync. It solved the problem for me. Cheers!!

like image 128
2 revs Avatar answered Jan 28 '23 00:01

2 revs