Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 460
Reem Aziz Avatar asked Mar 07 '17 16:03

Reem Aziz


People also ask

How do I fix Gradle's dependency cache may be corrupt?

Possible causes for this unexpected error Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.

What is Gradle sync issue?

Gradle Sync is a Gradle task who's main function is to check all the dependencies in your build. gradle files which are associated with your Android studio project and then download that specified version (if not downloaded already). Gradle Project Sync Failed.


Video Answer


1 Answers

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.

like image 105
Hamid Asghari Avatar answered Sep 21 '22 15:09

Hamid Asghari