https://kotlinlang.org logo
#dagger
Title
# dagger
c

coroutinedispatcher

11/08/2020, 4:49 PM
Anybody who can give me a hint on what I am doing wrong here? Using Hilt though https://stackoverflow.com/q/64739048/8914336
a

Ahmed Ibrahim

11/09/2020, 11:53 AM
It might be useful if you could put a reproducible sample on Github or somewhere else.
r

Rafal

11/10/2020, 8:14 AM
please check under your
build
folder if you have a generated code for your ViewModel (in your case it might be a
LoginViewModel_AssistedFactory
) if it is not present it might be a problem with your gradle setup
Copy code
implementation 'com.google.dagger:hilt-android:2.28-alpha'
    kapt 'com.google.dagger:hilt-android-compiler:2.28-alpha'
    implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha02"
    kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha02'
This setup made it working.. after one or two build cleans 😛
c

coroutinedispatcher

11/10/2020, 10:30 AM
Hmmm. I also assumed that it would be something wrong with the generated code. Thank you so much. I will try it later today
@Rafal did you try to
@Inject
constructor or
@ViewModelInject
constructor because I discovered that for this case is not possible https://github.com/google/dagger/issues/1865#issuecomment-642825286 to use
@ViewModelInject
. I would have to go with another approach I’m afraid.