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

Popular posts from this blog

Android - ImageView With Rounded Only One Corner

530 Valid Hostname Is Expected When Setting Up IIS 10 For Multiple Sites

403 Access Denied On Tomcat 8 Manager App Without Prompting For User/password