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

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

C Perror Example

Converting A String To Int In Groovy