I am trying to extend LifecycleService
. I have implemented the following in build.gradle
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
The below line gives error:
internal class MyService: LifecycleService() {
Unresolved reference: LifecycleService
What am I doing wrong here?
As per the Lifecycle Declaring dependencies, you need to use lifecycle-service
to use LifecycleService
:
implementation "androidx.lifecycle:lifecycle-service:2.2.0"
(This would in addition to lifecycle-runtime-ktx
)