I want to inject a class in Service
. Lets have a look at the code below:
class DeviceUtil @Inject constructor() {
...
}
@AndroidEntryPoint
class LocationUpdateService : Service() {
@Inject
lateinit var deviceUtil: DeviceUtil
...
}
@Inject lateinit var deviceUtil: DeviceUtil
is working fine in Activity but not working in Service
.
Its giving the error: kotlin.UninitializedPropertyAccessException: lateinit property deviceUtil has not been initialized