Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

I am getting this kind of error, how to fix it.

Error:Unable to load class 'org.gradle.tooling.internal.protocol.test.InternalTestExecutionConnection'. Possible causes for this unexpected error Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes. 
like image 716
Vatsal Harde Avatar asked Jul 18 '16 17:07

Vatsal Harde


People also ask

How do I fix Gradle's dependency cache may be corrupt?

Possible causes for this unexpected error Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.


1 Answers

I updated my Android Studio to 2.3 and it asked me to update my gradle plugin to 3.3 that created issues with my running projects. I've gone through all the Stack solutions and nothing worked for me except this workaround: I changed my distribution url in gradle-wrapper.properties with this one.

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip  

(permanent link list here : https://services.gradle.org/distributions/)

My project is up and running.It just asked me to update to gradle build tools 25.0.0 which I did so. Everything is fine now :)

  1. Go to the project section and select gradle scripts menu.
  2. Under script, menu select gradle -wrapper.properties
  3. Then replace the distributionUrl=https://services.gradle.org/distributions/gradle-2.2-all.zip with "distributionUrl=https://services.gradle.org/distributions/gradle-3.4.1-all.zip"

enter image description here note: distributions gradle will change depended upon the version of the android studio.

like image 111
Taimur Khan Avatar answered Sep 23 '22 02:09

Taimur Khan