Article From:https://www.cnblogs.com/guxin/p/9302750.html

Android StudioAfter importing the project, Gradle compile failed, and the following error was reported.

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>

A search was made because the Gradle version specified in the gradle-wrapper.properties file of the project does not exist. The following figure requires gradle-3.5-all.zip.

In the Gradle settings of AS, the default path of Gradle Home is C:\Users\ user name \.gradle\wrapper\dists\. Take a look at this directory and find that gradle-3.5-all files do exist.Clip.

Why did it still fail to find the target version of gradle? Comparing the other versions of gradle directory, it is found that the size of gradle-3.5-all.zip is obviously smaller than that of other versions. It turned out that the GFW network in the Heavenly Kingdom led to gra.When dle-3.5-all.zip was downloaded from the next serviices.gradle.org/distributions/, it was not downloaded completely. Gradle-3.5 can not be used normally.

The solution is to manually download gradle from the serviices.gradle.org/distributions/ web site (using the downloading tool such as thunder and so on) and drop it into the C:\Users\ username \.gradle\wrappeR\dists\ can. When you download the URL address, notice HTTPS instead of HTTP (more than s).

Without unpacking the compression package, open the AS to open the project and manually modify the gradle path in gradle-wrapper.properties to ask the local path:

After compiling the Gradle, you can see that the compression pack is decompressed. After the compilation is completed, the zip compression package can be deleted.

 

 

Reference: http://www.jcodecraeer.com/a/anzhuokaifa/Android_Studio/2017/0317/7691.html

 

One Reply to “Android Studio error Error:Failed to open zip file. Gradle’s dependency cache may cache”

Leave a Reply

Your email address will not be published. Required fields are marked *