10

Android Studio Failed to open zip file问题

 3 years ago
source link: http://www.androidchina.net/7450.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Android Studio Failed to open zip file问题 – Android开发中文站
你的位置:Android开发中文站 > Android开发 > 新手入门 > Android Studio Failed to open zip file问题

前言

在更新完studio之后,gradle 在编译更新的时候,弹出了如下的错误

Error: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-wrapper.properties文件的问题,原因是使用了gradle-3.3-all.zip,而gradle-3.3-all.zip无法直接在studio中下载下来。尝试了好几种的解决方法,最后花费了两个小时才解决。下面列出几个比较常见的解决方案。

▲ 解决方案

1 . 可以把gradle-wrapper.properties里修改了gradle的版本,与之前没有报错的gradle版本一致,然后再修改项目build.gradle文件中的com.Android.tools.build:gradle的版本号,具体是多少也是参照以前那些没有报错的项目。

2 . 直接在网上找到gradle-3.3-all.zip下载下来,不要解压缩,放在类似下面的目录中 C:\Users\Administrator.gradle\wrapper\dists\gradle-3.3-all\55gk2rcmfc6p2dg9u9ohc3hw9,这个办法没有试过,按理说是可以的。下载地址在这里找:http://services.gradle.org/distributions/ ,里面各个版本都有。

3 . 最简单的方法,适用于windows用户和masOS用户。将文件gradle-wrapper.properties中的

distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip
改成

distributionUrl=http://services.gradle.org/distributions/gradle-3.3-all.zip

将https的s去掉即可。ps:我mac电脑的studio就是这么解决的ㄟ(▔,▔)ㄏ

转载请标明出处:http://blog.csdn.net/donkor_/article/details/77503757

转载请注明:Android开发中文站 » Android Studio Failed to open zip file问题


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK