viewmodel dependencies not working in android studio

33 views Asked by At

My dependencies are as follows

    // Lifecycle Components
implementation "androidx.lifecycle:lifecycle-viewmodel:2.6.2"
implementation "androidx.lifecycle:lifecycle-livedata:2.6.2"
implementation "androidx.lifecycle:lifecycle-common-java8:2.6.2"

It is showing the following error
Could not find androidx.lifecycle:lifecycle-view-model:2.6.2.
Searched in the following locations: The link is showing not found on being opened
Same as above
Also tried this but showing the same error and the link is not found
From google documentation

    dependencies{
         `   Val lifecycleVersion = "2.6.2"
           ` Val archVersion = "2.2.0"`
`
                `   // ViewModel
                    implementation ("androidx.lifecycle:lifecycle-viewmodel:$lifecycleVersion")
                    // LiveData
                    implementation ("androidx.lifecycle:lifecycle-livedata:$lifecycleVersion")
                    // Lifecycles only (without ViewModel or LiveData)
                    implementation ("androidx.lifecycle:lifecycle-runtime:$lifecycleVersion")

                     // Saved state module for ViewModel
                    implementation ("androidx.lifecycle:lifecycle-viewmodel-saved-state:$lifecycleVersion")

        
                    // alternately - if using Java8, use the following instead of lifecycle-compiler
                    implementation ("androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion")``
                }
    / Repository configuration
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}
0

There are 0 answers