0

Whenever I create a new project or open the exciting one, gradle not building shows me this error

Failed to open zip file.
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
Re-download dependencies and sync project (requires network)

Then I change distributionUrl from https to http and perform Invalidate Caches / Restart, Gradle starts building.

Hamza Afzal
  • 55
  • 1
  • 8
  • Possible duplicate of [Error:Failed to open zip file. Gradle's dependency cache may be corrupt](https://stackoverflow.com/questions/42652980/errorfailed-to-open-zip-file-gradles-dependency-cache-may-be-corrupt) – Roberto Manfreda Jul 30 '18 at 15:41

1 Answers1

-1

Be sure that you are connected to the network.

Then open Android Studio and execute a clean and a rebuild task.

Try syncing gradle using the refresh button located at the top-right of the window more than once time, retry to invalidate cache/restart.

Be sure you added google() and maven() in your repositories -> build.gradle (project level).

If any of that tasks succeded try to delete your .android hidden folder, located at your installation path.

UPDATE: Try to go in your .gradle hidden folder then navigate to wrapper folder and delete the dists folder. Then restarts your ide.

You can refer to this question for more details: Error:Failed to open zip file. Gradle's dependency cache may be corrupt

Roberto Manfreda
  • 1,664
  • 2
  • 13
  • 33