Skip to content Skip to sidebar Skip to footer

Failed To Resolve : Androidx

I was working with one of the codelabs tutorials https://codelabs.developers.google.com/codelabs/android-room-with-a-view/index.html?index=..%2F..index#3 . Int which while editing

Solution 1:

Might be because you are missing the reference to the Google's maven repository in the project level build.gradle file:

buildscript {
    repositories {
        google() // this allow to lookup in the Google's maven repositoryjcenter()
    }

    ...
}

allprojects {
    repositories {
        google() // this allow to lookup in the Google's maven repositoryjcenter()
    }
}

Solution 2:

It was a silly mistake that I made by not seeing the difference in build.gradle(app) and build.gradle. If in case someone ran into same error follow this.It will take me two days to accept my answer but it worked for me.

build.gradle(app)

    implementation "androidx.room:room-runtime:$rootProject.roomVersion"
    annotationProcessor "androidx.room:room-compiler:$rootProject.roomVersion"
    androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion"// Lifecycle components
   implementation "androidx.lifecycle:lifecycle extensions:$rootProject.archLifecycleVersion"
    annotationProcessor "androidx.lifecycle:lifecycle-compiler:$rootProject.archLifecycleVersion"// UI
    implementation "com.google.android.material:material:$rootProject.materialVersion"// Testing
    androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion"

Leaving the roomVersion, archLifecycleVersion, coreTestingVersion & materialVersion as they are and adding the below version in build.gradle

build.gradle

    roomVersion = '2.2.1'
    archLifecycleVersion = '2.2.0'
    coreTestingVersion = '2.1.0'
    materialVersion = '1.0.0'
}```

Post a Comment for "Failed To Resolve : Androidx"