How to solve Gradle sync failed error (DefaultMavenFactory)?
I solve this problem. It was happening because Android Studio can't install Gradle 2.2.1 and using Gradle 2.4 (already installed). I just run gradlew.bat assembleDebug
command and then re-import this project again into Studio. Now it working well.
I also get into the similar issue because of the dependency com.github.dcendents:android-maven-gradle-plugin:1.4.1
.
To fix that we need to use the correct gradle version
as mentioned here. As mentioned in that page I updated the gradle version
in the grade\wrapper\gradle-wrapper.properties
file to 2.14
like below.
distributionUrl=https://services.gradle.org/distributions/gradle-2.14-all.zip
Note: Also take care about the plugin name
. I am using apply plugin com.github.dcendents.android-maven
. Refer the below table to find yours.
For reference I am added the content in the link below. Dated 16-July-2016
Plugin Version | Plugin Name | Dependency Information | Gradle Version
1.0 | android-maven | com.github.dcendents:android-maven-plugin:1.0 | 1.8+
1.1 | android-maven | com.github.dcendents:android-maven-plugin:1.1 | 1.12+
1.2 | com.github.dcendents.android-maven | com.github.dcendents:android-maven-plugin:1.2 | 2.2+
1.3 | com.github.dcendents.android-maven | com.github.dcendents:android-maven-gradle-plugin:1.3 | 2.4+
1.4.1 | com.github.dcendents.android-maven | com.github.dcendents:android-maven-gradle-plugin:1.4.1 | 2.14+
I was also facing same issue few days back. I solved it by updating maven plugin version and gradle-maven-plugin version. I updated plugin from
apply plugin: 'android-maven'
to
apply plugin: 'com.github.dcendents.android-maven'
and gradle version from
classpath 'com.github.dcendents:android-maven-plugin:1.2'
to
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
Hope it solves your issue also