Android Gradle 的依赖缓存可能已损坏且 gradle build 无法正常工作 [英] Android Gradle's dependency cache may be corrupt and gradle build not working

查看:43
本文介绍了Android Gradle 的依赖缓存可能已损坏且 gradle build 无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试导入此项目,即使我也尝试导入其他几个项目,但出现以下错误.

我花了 5 个小时在上面,即使我在谷歌上尝试了很多解决方案,但没有任何效果对我有用.

我尝试了以下解决方案,但没有任何效果.

1) 删除 .gradle 目录2)重启IDE,3)我用 com.android.tools.build:gradle-experimental:0.7.0-alpha1 进行了测试

因为这个 Gradle 和这些问题,我很沮丧.

Gradle 版本:Gradle-2.13,我不想改变这个版本.Android Studio 版本:稳定 2.1.1

注意:我的另一个项目运行良好,我也可以构建它.

解决方案

您可以针对此问题尝试不同的解决方法:

1- 清理项目并重建.

2- 在导入项目之前,删除Build 文件夹的内容.

然后用以下几行替换 gradle-wrapper.properties 文件的内容,使其使用本地发行版来构建项目:

distributionBase=GRADLE_USER_HOME分布路径=包装器/distszipStoreBase=GRADLE_USER_HOMEzipStorePath=wrapper/distsdistributionUrl=file\:/opt/gradle/gradle-2.13-all.zip

其中,最后一行阻止 android studio 下载或使用损坏的 gradle 缓存.

I am trying to import this project, even I tried to import other few projects too, I am getting below error.

https://github.com/ashdavies/data-binding

I have spent my 5 hours on it, even I tried many solutions on google but nothing gonna worked for me.

I tried following solutions, nothing worked.

1) delete .gradle directory
2) Restart IDE, 
3) I tested with com.android.tools.build:gradle-experimental:0.7.0-alpha1

I am frustrated because of this Gradle and these issues.

Gradle Version : Gradle-2.13, I do not want to change this version.
Android Studio Version : Stable 2.1.1

Note : My other project is working fine and I can build it too.

解决方案

You can try different workarounds for this problem :

1- Clean project and Rebuild it.

2- Before importing the project, remove the contents of the Build folders.

Then replace the contents of your gradle-wrapper.properties file with the following lines, to make it use a local distribution for building the project :

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=file\:/opt/gradle/gradle-2.13-all.zip

in which, the last line prevents android studio to download or use a corrupted gradle cache.

这篇关于Android Gradle 的依赖缓存可能已损坏且 gradle build 无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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