Android Gradle Dependency Cache May Be Corrupted and Gradle Not Working

I try to import this project, even I tried to import several other projects, I get below errors.

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

enter image description here

I spent 5 hours on it, even I tried many solutions on Google, but nothing worked for me.

I tried the 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 upset about this gradle and these problems.

 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.

+7
java android android-studio build.gradle gradle
Jun 25 '16 at 8:33
source share
6 answers

You can try various workarounds for this problem:

1- Clean and Restore .

2- Before importing the project, delete the contents of the Folder Assembly .

Then replace the contents of your gradle -wrapper.properties file with the following lines to use the local distribution to create 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 studios from loading or using the damaged gradle cache.

+5
Jun 25 '16 at 8:43
source share

Because your gradle path for the project is wrong. Go to -> Settings -> Gradle

and select "use default gradle settings" and than synchronize the project. and the problem will be solved.

+1
Mar 25 '17 at 7:52
source share

In my case, this happened because I did not use the JDK path in the environment variable. Please check in Android studio studio that the correct JDK path is.

Go to project structure> SDK Location and check the JDK path. Give it the correct JDK path and also set the JAVA_HOME environment variable.

enter image description here

+1
Jun 16 '17 at 7:11
source share

You can try this solution since I ran into this problem, since Error2 Gradle dependency cache may be damaged and Gradle build does not work and resolved it. Already answered this question on the stack. You can answer this answer link.

It includes first downloading the latest version of graddle from the official site, and then replacing this unpacked file with home / yourUser / .graddle / wrapper / dists containing the old version file on the Mac.

0
Jan 23 '17 at 9:07 on
source share
  • Go to any browser

  • type gradle and press enter

you can specify any version you want after

gradle keyword

Download gradle 3.3

  1. https://services.gradle.org/distributions click on this link, which is located in the description, if you want

  2. click gradle 3.3 all.zip

  3. wait for the download to complete

  4. after the download is complete, extract the file to the folder

c: // user / your pc name / .gradle / wrapper / dists

  1. wait for the extraction to take 5 minutes.

  2. Now open your project in the Android studio.

9.go to file> settings> bulid, exec, deployment> gradle

  1. now change the default gradle value to

use local gradle distributn

select the place where you extracted gradle 3.3.zip

C: \ Users \ your pc name.gradle \ wrapper \ dists \ gradle -3.3

  1. click ok

  2. Now the assembly starts again and

you can see that the assembly was successful and the error has been resolved.

or

watch the tutorial https://www.youtube.com/watch?v=u92_73vfA8M

0
Apr 04 '17 at 9:16 on
source share

In my case, loading gradle-5.1.1-all.zip failed, so I go to zipStoreBase + zipStorePath (configured in gradle-wrapper.properties, for example: E: \ gradle-home \ wrapper \ dists) and delete gradle-5.1 .1-all, and let android studio download this zip file again.

0
Apr 28 '19 at 16:08
source share



All Articles