Hi, I am trying to inject field with Dagger 2 into...
# android
p
Hi, I am trying to inject field with Dagger 2 into a singleton, that I have implemented with object but it fails with "Dagger does not support injection into static fields" because fields in kotlin objects are treated as static. Is it possible to inject it somehow
d
Make a
@Singleton fun provideX(dependency: Y)
in your module and then pass to the constructor, don't make object classes, use dagger to handle the Singleton
p
nice, thanks @dave08
149 Views