-3

Before Updating my Android Studio it was working fine but before 2 days I had updated my studio then the problem is started.

UPDATE FROM VERSION 3.1 to 3.3

Now, It is giving me this error

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)

It shows me error all the time when i trying to open the project in studio evenly on making new projects or importing my old projects

My error is solved when i am update my gradle wrapper class...

FROM THIS->

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

To THIS->

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

How can i solve it permanently for my future projects

Vipul Chauhan
  • 383
  • 2
  • 15
  • Have to look at this [answer](https://stackoverflow.com/questions/42652980/errorfailed-to-open-zip-file-gradles-dependency-cache-may-be-corrupt) – Tanveer Munir Feb 21 '19 at 08:23

1 Answers1

1

1) Manually download Gradle 3.3 binary (direct link: https://downloads.gradle.org/distributions/gradle-5.2.1-bin.zip)

2) Open your android studio root directory, and extract the zip to the gradle folder (for example in my Debian machine the full path is /opt/android-studio/gradle/gradle-3.3)

3) Open Android Studio, go to File->Settings->Build, Exectution, Deployment->Gradle and set "Gradle home" to point your new gradle-3.3 folder.

4) Sync and you are ready to go!

I hope that helps.

Tanveer Munir
  • 1,936
  • 1
  • 10
  • 25
  • tanvir post the exact link this link is old now currently the latest gradle version is 5.2 – Vipul Chauhan Feb 21 '19 at 08:28
  • it is showing me same error as i mentioned above and also one thing i want to let you know that I have just checked the default settings of gradle. and in the Service Directory Path the path of gradle also contains 5.2.1 – Vipul Chauhan Feb 21 '19 at 08:44
  • @VipulChauhan You may be having different projects on the different gradle build. you can download manually all gradle-5.2.1-all.zip from this [source](https://services.gradle.org/distributions/) change the resource directory of gradle by manually – Tanveer Munir Feb 21 '19 at 08:54