且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误:无法打开 zip 文件.Gradle 的依赖缓存可能已损坏

更新时间:2022-06-16 21:17:23

2018 年 7 月 17 日更新:

即使以下解决方案在今天仍然有效,我发现(感谢 Hamid Asghari 发布的答案和 Mahendra Dabi 发布的评论)只需删除 gradle dist 目录并重新启动 ide, 将解决该问题(请阅读 Hamid 帖子以获得完整答案,并记住 OSX 和 Linux 具有相同的 gradle 路径).

Even if the following solution still works as of today,I've found (thanks to the answer posted by Hamid Asghari and to the comment posted by Mahendra Dabi) that simply deleting the gradle dist directory and performing a reboot of the ide, will fix the issue (please read Hamid post for a full answer, and remember that OSX and Linux have the same gradle path).

如果你仍然想遵循我原来的解决方案,你至少应该考虑使用更新版本的 Gradle(gradle 分发库的直接链接:https://services.gradle.org/distributions/)

If you still want to follow my original solution, you should at least consider using a more up-to-date version of Gradle (direct link of the gradle distribution repo: https://services.gradle.org/distributions/)

原始答案(2017 年 3 月 7 日):

今天早上我在将 Android Studio 升级到 2.3 后遇到了同样的问题.解决问题:

I've faced the same issue this morning after upgrading Android Studio to 2.3. To solve the issue:

1) 手动下载 Gradle 3.3 二进制文件(直接链接:https://services.gradle.org/distributions/gradle-3.3-bin.zip)

1) Manually download Gradle 3.3 binary (direct link: https://services.gradle.org/distributions/gradle-3.3-bin.zip)

2) 打开你的 android studio 根目录,将 zip 解压到 gradle 文件夹(例如在我的 Debian 机器中,完整路径是/opt/android-studio/gradle/gradle-3.3)

2) Open your android studio root directory, and extract the zip to the gradle folder (for example in my Debian machine the full path is /opt/android-studio/gradle/gradle-3.3)

3) 打开 Android Studio,转到 File->Settings->Build、Execution、Deployment->Gradle 并将Gradle home"设置为指向新的 gradle-3.3 文件夹.

3) Open Android Studio, go to File->Settings->Build, Exectution, Deployment->Gradle and set "Gradle home" to point your new gradle-3.3 folder.

4) 同步,您就可以开始了!

4) Sync and you are ready to go!