Reputation: 9390
I want to observe livedata with
viewlifecycleowner
instead of
this
but it is not resolved. What is the dependency for it?
Upvotes: 6
Views: 4628
Reputation: 9390
https://developer.android.com/jetpack/androidx/releases/lifecycle
def lifecycle_version = "2.8.7"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
// Lifecycles only (without ViewModel or LiveData)
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
Upvotes: 4