升级到gradle 2.1.0原因–无法扩展ZIP错误 [英] Upgrading to gradle 2.1.0 causes – Could not expand ZIP error

查看:209
本文介绍了升级到gradle 2.1.0原因–无法扩展ZIP错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将Android项目的gradle插件从2.1.0-alpha4更新为了2.1.0.但是现在我看到我所有的构建都失败,并显示如下消息:

I recently updated my Android project's gradle plugin to 2.1.0 from 2.1.0-alpha4. But now I see that all my builds fail with a message like so:

Error:Execution failed for task ':App:compileUpdemoDebugJavaWithJavac'.
> Could not expand ZIP '/Users/admin/work/app/libs/lib-android-0.11.0.jar'.

如果我将gradle插件恢复为以前的2.1.0-alpha4版本,请设置环境变量ANDROID_DAILY_OVERRIDE,然后构建我的项目-一切正常.

If I revert my gradle plugin to the previous 2.1.0-alpha4 version, set the environment variable ANDROID_DAILY_OVERRIDE and then build my project — everything works just fine.

还有其他人遇到这个问题吗?我认为这与最新的插件有关,因此,人们可能会开始偶然发现这个问题.

Has anyone else come across this problem? I believe this is related to the latest plugin, and so, people might just start to stumble across this problem.

任何可能的解决方案? (我知道一些变通方法,例如提取JAR并让gradle跳过JAR提取过程,但这听起来确实不值得!)

Any possible solutions? (I am aware of some workarounds, like extracting the JAR and making gradle skip the JAR extraction process, but that certainly doesn't sound worth the effort!)

推荐答案

不幸的是,此处发布的大多数答案都无法解决.尽管从逻辑上讲,@ Kowshick的答案似乎解决了正确的事情-即目录权限有问题.但是,授予777访问权限不是正确的选择,并且我在开发文件夹,sdk文件夹,build文件夹中使用的默认755应该很好用.但是不是. :(

Unfortunately, most of the answers posted here didn't work out. Although, logically speaking, @Kowshick's answer seemed to tackle the right thing — i.e, there's something wrong with the directory permissions. However, giving 777 access can't be the right thing, and the default 755 that I had on my development folder, sdk folder, build folder — should've worked just fine. But it didn't. :(

最终,我意识到只有3种方法可以解决此问题:

Eventually, what I realised is that there are only 3 ways to resolve this problem:

  1. 等待Google发布其构建工具的更新,该更新将更新gradle插件,并希望解决此问题.
  2. 当您等待上述事情发生时,对我有用的 only 只是将gradle插件降级为2.0.0版本.通过降级工作的事实表明,真正的问题并不在于我拥有的目录权限.
  3. 最后,您可以做的一件令人沮丧的事情-在系统上创建一个单独的用户,然后从头开始设置您的项目-下载Android Studio,SDK和您的工作区.它很有可能会起作用,但这是一种可怕的工作方式.最重要的是,如果您没有支持快速用户切换的操作系统,那么您将感到无比痛苦.
  1. Wait for Google to release an update to its build tools, which would update the gradle plugin, and hopefully resolve this issue.
  2. And while you wait for the above to happen, the only thing that worked for me was to downgrade the gradle plugin to version 2.0.0. The very fact that it works by downgrading, shows that the real issue isn't with the directory permissions I have.
  3. Finally, there's this rather frustrating thing you can do — create a separate user on your system, and setup your project from scratch — download Android Studio, SDK and your workspace. There's a good chance it'll work, but it's a horrible way to work. And on top of that, if you don't have an OS which supports fast user switching, you're just going to feel a world of pain.

就我而言,我使用选项2幸存了一段时间,我很幸运将硬盘驱动器升级到了SSD,所以我最终也选择了选项3(因为我做了全新安装)我的操作系统在SSD上的状态.

In my case, I survived using option # 2 for some time, and I was just lucky that I had my hard drive upgraded to an SSD, so I finally ended up doing option # 3 too (since I made a fresh install of my OS on the SSD).

其他信息:
操作系统— OS X(El Capitan)
Android Studio-2.1.0

Other info:
OS — OS X (El Capitan)
Android studio — 2.1.0

这篇关于升级到gradle 2.1.0原因–无法扩展ZIP错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆