AS - Failed to open zip file. Gradle's dependency cache may be corrupt

异常信息:

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)

《AS - Failed to open zip file. Gradle's dependency cache may be corrupt》

具体描述:

    之前项目的 Gradle 都是在线更新,升级到 AndroidStudio 3.0+ 后不能在线更新下载了。提示连接不到网络。。。Gradle 官网在国内轻松打开啊,难道没用官网的链接下载。

解决方案:

1. 手动去官网下载相应的 Gradle 版本,比如 :http://services.gradle.org/distributions/ 下载最新的 gradle-4.4-bin.zip。

2. 下载完成后,将 zip 包解压到 AndroidStudio 安装目录的 gradle 文件夹下。

《AS - Failed to open zip file. Gradle's dependency cache may be corrupt》

3. 打开 AndroidStudio 打开 File -> Settings -> Gradle -> Build, Exectution, Deployment -> Gradle and set “Gradle home” 指向上面的解压目录。

《AS - Failed to open zip file. Gradle's dependency cache may be corrupt》 我实际使用的是4.1版本

4. Sync 一下项目,就可以使用了。

《AS - Failed to open zip file. Gradle's dependency cache may be corrupt》

    原文作者:Jiun俊
    原文地址: https://www.jianshu.com/p/d079801c8281
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞