Status Update
Comments
am...@gmail.com <am...@gmail.com> #2
UPDATE: Based on Ian Lake's AndroidManifest.xml
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
tools:node="remove" />
I have analyzed the APK, and androidx.work.impl.WorkManagerInitializer
provider is no longer there after manifests are merged.
However, I am still getting same error.
Attached
- Updated patch file
- WorkManager debug log
am...@gmail.com <am...@gmail.com> #4
Created brand new Android project to reproduce this issue. Attached dagger-hilt-aosp-issue-158843197.zip
A snapshot of all the key files in that project is hosted on
am...@gmail.com <am...@gmail.com> #5
Filed another issue
vi...@google.com <vi...@google.com>
vi...@google.com <vi...@google.com> #6
su...@google.com <su...@google.com> #7
Dany, do you mind triaging this? It's about Hilt docs, not WorkManager.
su...@google.com <su...@google.com> #8
Sorry, I meant it's about Hilt docs and code* since something is going wrong in the Hilt-provided WorkerFactory.
da...@google.com <da...@google.com> #9
Thanks for sharing a sample app in build.gradle
it seems you are missing a dependency:
// Hilt dependencies
implementation "com.google.dagger:hilt-android:$hilt_version"
implementation 'androidx.hilt:hilt-work:1.0.0-alpha01'
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha01' // ADD THIS LINE
Add kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha01'
to your app's build.gradle
and it should work.
am...@gmail.com <am...@gmail.com> #10
Thanks! sorry I missed that line from the guide. It's working now with the dependency above. The issue can now be closed.
Description
Artifact used androidx.hilt:hilt-work:1.0.0-alpha01: Version used: 1.0.0-alpha01 Theme used: Devices/Android versions reproduced on: Pixel 4 XL, Emulator
The guides provided athttps://developer.android.com/training/dependency-injection/hilt-jetpack#workmanager to inject WorkManager Worker did not work
Added patch file that should be applied on top ofhttps://github.com/googlecodelabs/android-hilt/tree/solution and run the app which produces
solution
branch ofA question with same issue is also posted on StackOverflowhttps://stackoverflow.com/questions/62355282/android-workmanager-worker-can-not-be-injected-using-dagger-hilt-workerinject