Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle error after studio update

I've recently upgraded from 1.2.2 to 1.3.2 and was introduced with the following error:

Error:Unable to load class 'org.gradle.api.publication.maven.internal.DefaultMavenFactory'.

Possible causes for this unexpected error include:

  • You are using JDK version 'java version "1.7.0_79"'. Some versions of JDK 1.7 (e.g. 1.7.0_10) may cause class loading errors in Gradle. Please update to a newer version (e.g. 1.7.0_67).

    Open JDK Settings

  • 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.

My project is using the SquiDB library if that matters, has anyone encountered similar error and could help me out how to fix it?

like image 984
Lukasz 'Severiaan' Grela Avatar asked Aug 26 '15 07:08

Lukasz 'Severiaan' Grela


2 Answers

if your gradle.properties file which is located at the root level of your project contains :

classpath 'com.github.dcendents:android-maven-plugin:1.2',

try to change to:

classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'

I solved the same problem in this way, and hope you will as well.

like image 122
woxingxiao Avatar answered Sep 24 '22 12:09

woxingxiao


I don't know why but following has worked:

Open the Settings panel

Go to Build, Execution, Deployment > Build Tools > Gradle

On right in the form under the Project-level settings heading select Use default gradle wrapper (Recommended)

In my case I had selected Use local gradle distribution for some reason.

if you know the reason behind the issue and solution applied please add another answer with explanation and I will make it accepted.

like image 31
Lukasz 'Severiaan' Grela Avatar answered Sep 22 '22 12:09

Lukasz 'Severiaan' Grela