Error:Failed to open zip file. Grad...">

How to fix "Gradle dependency cache error may be damaged" after updating Android Studio from 2.2.3 to 2.3?

enter image description here

> Error:Failed to open zip file. Gradle 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> 
+13
source share
9 answers

Find 'gradle-wrapper.properties' in the root project

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

Change "https" to "http".

Please see the image. enter image description here

+32
source

go to the folder "home.gradle \ wrapper \ dists" and cut / delete the folder "gradle -3.3-all", now update the project. This should fix the problem as it worked for me.

+9
source

I encounter this problem after updating Android Studio from 2.2.3 to 2.3;

Decision

1) In your project, open "gradle-wrapper.properties", change the value of "distributionUrl"

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

2) In your project, open the build.gradle project file and change the class path

  classpath 'com.android.tools.build:gradle:2.3.0' 

3) Finally synchronize your project.

(This is the last Gradle setting.)

+6
source

Step 1 Go to the directory (cd ~) and do ls -la, it will show you the .gradle folder. Do cd.gradle / wrapper / dists / gradle-3.3-all and verify the input is correct

provide full permission

 sudo chmod -R 777 .gradle/ 

this will provide full resolution for the .gradle folder

Step 2 Delete Previous

 rm -rf .gradle/wrapper/dists/gradle-3.3-all/ 

Step 3 Use Restart and disable the Android Studio option, it will clear the previous cache and load the fresh gradle-3.3-all file

Step 4 Please keep the correct internet connection at a good speed. it will download all the necessary files. This problem usually occurs when your internet connection is unstable or has a slow speed. I say this according to the error log given by AS. Error: Could not open the ZIP file.

 Gradle 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> 
+4
source

If all else fails, the option is to use the local gradle distribution.

Download the archived version of Gradle.

unzip it and put it in a directory. Preferably C:\Program Files\Android\Android Studio\gradle

Like at the time of writing, I am using gradle-3.4.1-bin

Then, directly gradle to this directory:

File > Settings > Gradle > use local gradle distribution

enter image description here

Sync your project, and you're good to go.

Note. Although it is recommended that you use the default gradle wrapper, this option is fine. The only problem is that you need to manually keep track of updates, etc.

+4
source

I had the same problem.

This ANSWER solved my problem, it can also solve your problem.

+2
source

To solve this problem:

  • Go to gradle -wrapper.properties from the project side menu

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

After that, the studio should be able to download the correct zip file, that is, "gradle -3.3-all.zip".

If this does not help, you will have to make a few efforts:

  • Download the zip file manually from gradle -3.3-all.zip
  • Copy the zip file.
  • Return the directory wherever your ".gradle" folder exists. Usually it is in "C: \ Users \ user.gradle" if you are in windows.
  • Go to "wrapper" and then "gradle -3.3-all".
  • Replace the zip file that is already there with the new downloaded zip file.

enter image description here

+2
source

this case appears when I try to open another project that I download from github, so I just change all the gradle files in the whole project to the latest version of gradle build

  • build.gradle -> module application // compileSdkVersion and buildToolsVersion
  • build.gradle → project // classpath "Com.android.tools.build: gradle: CurrentVersion
  • build.gradle -> library .
  • gradle -wrapper.properties -> be precise to check distributionUrl starts with https not http

all this solves the problem for me ..

+1
source

I ran into the same problem 4 days ago, and today I was able to solve it by changing

Compile Sdk Version - 26

Target Sdk Version - 26

Min Sdk Version - 26

Build Tools Version - 28

going to

  File > Project Structure > 

enter image description here

enter image description here

What did not work ::

  1. delete .gradle folder
  2. Download Gradle with Android Studio
  3. Manual Gradle Download
  4. Android studio update
0
source

Source: https://habr.com/ru/post/1265041/


All Articles