2

I recently updated android studio version from 2.2.3 to 2.3 and My Working project starts throwing error below.

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)

I searched a lot and find many solutions but no one suitable to solve my error

Community
  • 1
  • 1
sodhankit
  • 1,138
  • 1
  • 14
  • 26

3 Answers3

2

I faced same problem and I solve it by the following steps

Step one:

You need need set the gradle path as follow in my case i use local gradle.

File -> Setting ->Gradle -> Use local gradle distribution -> Browse to your gradle folder

in my case it is under C:/Program Files/Android/Android Studio/gradle/gradle-3.3

Step Two:

I change the distribution URI inside gradle-wrapper.properies file.

from

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

to

distributionUrl=C\:\\Program Files\\Android\\Android Studio\\gradle\\gradle-3.3-all.zip

Reference here

Sanoop Surendran
  • 3,484
  • 4
  • 28
  • 49
Munir sf
  • 36
  • 3
0

I was facing the same issue. Few points you can verify :-

  1. It may be your internet connection issue so check your internet connection is working well.
  2. This can be solve by Perform invalidate cache/ Restart
  3. If above 2 options are not wokring you need to reload the the dependencies so perform rm -rf $HOME/.gradle/caches/ and ./gradlew build --refresh-dependencies perform both of these commands and reverify your gradle path. This may solve your problem.
David Buck
  • 3,752
  • 35
  • 31
  • 35
-1

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 the Android Studio and delete the following directory's content, necessary files will be downloaded on IDE's next launch.

macOS: ~/.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.