> 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>

- 26,627
- 26
- 120
- 132

- 301
- 1
- 2
- 4
-
Have you tried to clean project, build -> clean – Maytham Fahmi Mar 04 '17 at 12:51
-
1just click on the error message that says **re-download...** and wait until it finishes downloading and installing. and while doing so make sure you have a stable network connection – phoenix Mar 04 '17 at 12:52
-
@Mr.Rabbit i do this but he field .... and i dont what i do – Khaled Mohsen Mar 04 '17 at 13:02
-
1I have 2.2.3 to 2.3 updating error. I installed the Android Studio 2.3 again. – Roma Darvish Mar 04 '17 at 13:08
-
@Mr.Rabbit I tried what you said but it does nothing... – HQuser Mar 05 '17 at 05:34
-
OK. One thing you can try is delete all the files from cache folder of gradle. and then when you try to rebuild your project android studio will prompt you to install the dependencies again. path for the cache folder: **home/.gradle/caches/** .P.S: It's hidden by default. – phoenix Mar 05 '17 at 06:37
-
In these situations File --> Invalidate Caches/Restart... --> Invalidate and Restart works for me. – Nemus Mar 06 '17 at 03:06
-
Possible duplicate of [Error:Failed to open zip file. Gradle's dependency cache may be corrupt](http://stackoverflow.com/questions/42652980/errorfailed-to-open-zip-file-gradles-dependency-cache-may-be-corrupt) – Md Imran Choudhury May 04 '17 at 16:22
-
The answer is in the below link: https://stackoverflow.com/a/44205838/7663327 – Kerelos Jun 07 '17 at 23:22
11 Answers
Find 'gradle-wrapper.properties' in root project
distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip
Change "https" to "http".

- 536
- 4
- 8
-
2
-
1but what are the implications? This seems more like a hack since we are compromising on SSL end point – Sudip Bhandari Sep 24 '18 at 12:29
-
1thanks perfect fix... but it is unfortunate that the default blank activity app has this issue... – Antonin GAVREL Dec 12 '18 at 15:10
-
In my case `distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-all.zip` was throwing the same error posted in the question. Now with `distributionUrl=http\://services.gradle.org/distributions/gradle-5.4-all.zip` it says `Gradle Sync: Download http://services.gradle.org/distributions/gradle-5.4-all.zip`. It looks like it is fixing it for me too. – Jaime Montoya May 13 '19 at 17:22
-
1I tried this steps In android studio 3.6.1 but it failed with: 7:38 PM Gradle sync failed: Server returned HTTP response code: 403 for URL: http://services.gradle.org/distributions/gradle-5.6.4-all.zip – JeanCarlos Chavarria Mar 23 '21 at 01:39
-
Instead of changing the protocol, you can add a "?" at the end of the URL and AS will download everything again, like this: "distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip?" – dmastra Jan 25 '22 at 14:21
go to the "home.gradle\wrapper\dists" folder and cut/delete the "gradle-3.3-all" folder, now rebulid the project. This should resolve the issue, as it worked for me.

- 151
- 3
I face this problem after updating Android Studio from 2.2.3 to 2.3;
Solution
1) In your project open 'gradle-wrapper.properties', change the 'distributionUrl' value
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
2) In you project open the project's 'build.gradle' file, and change the classpath
classpath 'com.android.tools.build:gradle:2.3.0'
3) At last Sync your project.
(This is the latest gradle setting.)

- 30,962
- 25
- 85
- 135

- 831
- 10
- 10
Step 1 Go to your dir (cd ~) and do ls -la , It will show you .gradle folder. Do cd .gradle/wrapper/dists/gradle-3.3-all and check it premission
provide full permission
sudo chmod -R 777 .gradle/
it will provide full permision to .gradle folder
Step 2 delete the previous one
rm -rf .gradle/wrapper/dists/gradle-3.3-all/
Step 3 Use Restart and invalidate option of Android Studio it will clear previous cache and download fresh gradle-3.3-all file
step 4 Please keep your internet connection proper with good speed. it will download all required file. This issue gennerally comes when your internet connection is not stable or have slow sped. I am saying this as per error log given by AS. 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>

- 30,962
- 25
- 85
- 135

- 2,262
- 1
- 19
- 19
If everything else fails, an option is to use a local distribution of gradle
.
Download a zipped version of Gradle.
unzip it and place it in a directory. Preferably C:\Program Files\Android\Android Studio\gradle
As at time of writing, I am using gradle-3.4.1-bin
Then, direct gradle to this directory:
File > Settings > Gradle > use local gradle distribution
Sync your project and you are good to go.
Note: Although it is recommended to use the default gradle wrapper, this option is fine.The only "problem" is you have to manually track updates etc

- 26,627
- 26
- 120
- 132
for mac user just go to the ~/.gradle/wrapper/dists
and delete all the folders there
for more explanation follow the detail below
- open finder
- Go ->
Go to Folder
- type
~/.gradle/wrapper/dists
and press enter - delete all the folders in it
- now, restart android studio, it will download all the files again

- 2,497
- 28
- 25
Just delete gradle
folder , and let android studio
download it again with click on Sync now
!.

- 6,656
- 2
- 44
- 44
In order to solve it:
Go to gradle-wrapper.properties from the "project" side menu
Change:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
todistributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip
After this studio should be able to download the correct zip file i.e. "gradle-3.3-all.zip".
If this does not help then you will have to make a few efforts:
- Download the zip file manually from gradle-3.3-all.zip
- Copy the zip file.
- Reach the directory wherever your ".gradle" folder exists. It's usually in "C:\Users\user.gradle", if you are on windows.
- Navigate to "wrapper" and then to "gradle-3.3-all".
- Replace the zip file already there with the newly downloaded zip file.
this case appear to me when try to open another project that I download it from github so I just change all gradle files in all project to the latest gradle build
- build.gradle --> module app // compileSdkVersion and buildToolsVersion
- build.gradle --> project // classpath 'com.android.tools.build:gradle:currentVersion
- build.gradle --> library is exist.
- gradle-wrapper.properties --> be accurate to check the distributionUrl is start with https not http
all of this solve the problem for me ..

- 1,527
- 14
- 15
I faced the same issue 4 days ago and today I was able to solve it by changing the
Compile Sdk Version
to 26
Target Sdk Version
to 26
Min Sdk Version
to 26
Build Tools Version
to 28
by going to
File > Project Structure >
What did not work::
- deleting .gradle folder
- downloading gradle with Android studio
- downloading gradle manually
- Updating Android studio

- 456
- 1
- 5
- 9
I had different distributionUrl in two gradle-wrapper.properties inside my project

- 1,608
- 1
- 18
- 42