Skip to content Skip to sidebar Skip to footer

Failed To Resolve: Support-fragment Error When Add Google Architecture Component Dependency

I want to use Google architecture components in my app, but after updating android studio to version 3.1.1 when I add android.arch.lifecycle:extensions:1.1.1 dependency into app.gr

Solution 1:

I had a similar error and changing the repositories order so that google() comes before jcenter() fixed it.

I had to change the order for the repositories within buildscriptandallprojects in the top level build.gradle file.

Please see this commit: https://github.com/kunadawa/ud851-Exercises/commit/9f6720ef4d52c71b206ddaa8477f2cf6e77a66f4

Solution 2:

I also had to remove the maven url from the project build.gradle as in:

 buildscript {
        repositories {
            google()
            jcenter()
          //  maven { url 'https://maven.google.com' }
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.3'
        }
    }
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }

This now works for me.

Solution 3:

add these two to build.gradle -> repositories

{
mavenCentral()
google() 
}

and add to these are to allprojects

allprojects {
repositories {
mavenCentral()
google()
}
}

Solution 4:

Solution 5:

This just happened to me with a project I cloned from github.

I updated my SDK and buildtools and had to double check all the dependencies to match the buildToolsVersion and the compileSdkVersion from the project.

The error message wasn't very clear when I tried to sync the project, it only gave me a more explicit error when I tried to run and it failed.

Could not find support-fragment.jar (com.android.support:support-fragment:27.0.2).

Good Luck!

Post a Comment for "Failed To Resolve: Support-fragment Error When Add Google Architecture Component Dependency"