Rakesh
Rakesh

Reputation: 199

error: package android.arch.lifecycle does not exist

I am getting error: package android.arch.lifecycle does not exist and i tried to resolve it, i used below links : but none of these resolve it:

Failed to resolve: android.arch.lifecycle:extensions:1.0.0-alpha1 android studio 3.0 Could not resolve android.arch.lifecycle:extensions:1.1.0

i have below dependencies :

 // Room components
    implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
    annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"
    androidTestImplementation "android.arch.persistence.room:testing:$rootProject.roomVersion"

    // Lifecycle components
    implementation "android.arch.lifecycle:extensions:$rootProject.archLifecycleVersion"
    annotationProcessor "android.arch.lifecycle:compiler:$rootProject.archLifecycleVersion"

Recently I got this link: https://developer.android.com/jetpack/androidx/releases/lifecycle#java which says : The APIs in lifecycle-extensions have been deprecated. Instead, add dependencies for the specific Lifecycle artifacts you need.

Does this mean now I need to use individual packages?

Upvotes: 0

Views: 1634

Answers (2)

Rakesh
Rakesh

Reputation: 199

Finally i got the answer. android.support is deprecated , i migrated to androidx via following links:

https://medium.com/androiddevelopers/migrating-to-androidx-tip-tricks-and-guidance-88d5de238876 https://developer.android.com/jetpack/androidx/migrate

And at last if you get error like buttler knife/ (or any third party lib) not resolved, find android x compatible version i used:

// butter knife
    implementation 'com.jakewharton:butterknife:10.0.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'

Upvotes: 0

EraftYps
EraftYps

Reputation: 818

The android.arch packages have been deprecated, try using androidx packages instead. Also make sure you've added google() in your build.gradle.

Upvotes: 2

Related Questions