Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle project sync failed in android studio while developing app

Tags:

android

Error:Unable to find method 'com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V'.

Possible causes for this unexpected error include:

  • 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 kill all Java processes.
like image 911
Manoj Pantha Avatar asked Nov 30 '17 11:11

Manoj Pantha


1 Answers

Though its late but I am posting this solution (worked for me) to help if someone get same error.

I built a project on android-studio 3.0.1 and the gradle value was gradle-4.1-all.zip. But when I tried to build same project on android-studio 2.2.3 I got this error. As my gradle version is gradle-2.14.1-all.zip

So by changing distributionUrl property in gradle-wrapper.properties file fixed this error for me.

like image 180
Md Sufi Khan Avatar answered Nov 01 '22 09:11

Md Sufi Khan