Android WorkManager Worker Can Not Be Injected Using Dagger Hilt `@WorkerInject`
Answer :
As per the WorkManager Configuration and Initialization documentation, to use the Configuration.Provider
interface on your Application
, you must remove the default initializer:
<!-- In your AndroidManifest.xml --> <provider android:name="androidx.work.impl.WorkManagerInitializer" android:authorities="${applicationId}.workmanager-init" tools:node="remove" />
Otherwise, the default initializer will still run, wiping out your custom intialization and its HiltWorkerFactory
.
Comments
Post a Comment