Mac下解决AS出现Failed to open zip file. Gradle‘s dependency cache may be corrupt问题

    技术2022-07-10  113

    导入项目报错如下:

    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)

    字面意思就是gradle的zip包不全,从gradle下查看当前项目的gradle版本是2.14.1。

    到系统gradle目录下查看对应版本的安装包果然和其他版本gradle不一样,不用自己去官网下替换,直接在目录下删掉错误的gradle包,回到项目中Rebuild一下重新下载对应版本的gradle就好了。

    gradle安装目录一般在个人用户下User/xxx/.gradle/wrapper/dists/gradle-2.14.1-all

    或者在AS配置下查看当前电脑的gradle安装目录

    Processed: 0.017, SQL: 9