您的位置:首页 > 移动开发 > Android开发

Android导入包报错问题Failed to complete Gradle Execution Cause: error in opening zip file.

2016-03-08 18:08 387 查看
这里的话我参考了Stack overflow上的回答 先给出解释 后面给出如何解决的办法

An "error in opening zip file" tends to mean that a file that Gradle has downloaded has somehow become corrupted -- this might be the download of Gradle itself (which the wrapper does),
or a dependency that Gradle has downloaded to run your build.

Gradle doesn't attempt to detect or resolve the problem, so you need to fix it manually. The solution is often to purge Gradle's download caches and let it get fresh copies of what it
needs. To do that, delete the 
.gradle
 directories
in both your home directory and in your project's root directory and try building again.

错误的打开zip ,往往意味着下载工具本身出错。  好的 ,从这里我分析出可能是gradle插件出了问题 ,但是又出于某种原因(如天朝墙的原因,很多开发者往往在导入github项目的时候,因为要下载符合该项目配套的gradle插件是点了取消,但重新开启时不能更新导致的) 好的,到这里我猜测可能要手动的把gradle包给删除。



好的,我随便找了一个项目, ok 很明显发现这个gradle插件版本号为2.2.1  ,好了 那么我们就去本地目录里删除他 我们找到gradle-wrapper.properties这个文件



一般的话 ,目录位置是在这 ,好的那么我们进入2.2.1的目录  记住是-all  不是-bin



一般正常的grdle是包含4项

大小在5MB左右 , 很好 ,那么如果大小不正常的并且可能没有4项的,那我们就删除整个文件夹就ok了



到这里,我们重新打开android studio ,我们又会进入 download gradle 的界面  !如果电脑上装了360安全卫士的话,

我们可以比较下android studio 的下载速度 ,因为被墙了 ,不可能太快你懂的。估算下100kb1s秒钟,那么我们大概下载完

一个gradle 插件要5分钟左右!  好了请耐心等待吧 ,不要再乱点了!  

当然也可以下载离线的gradle包,不过比较麻烦 ,这里就不做介绍啦。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android-studio报错