For anyone using hilt, our app has a really big gr...
# android-architecture
m
For anyone using hilt, our app has a really big graph at the moment (a ton of modules). We’re considering using hilt in our libraries first, and would need to get objects from our existing component into the SingletonComponent. I tried creating a bridge module which would pull from our singleton components’ holder to get the objects. However, it seems when i switch from the dagger to the hilt compiler, it’s not generating my existing components. If i have both, i get an error that it can’t find some MemoizedSential internal class. Has anyone even tried this before?
k
I got the impression that you couldn't use Hilt in libraries. I had to just use Dagger
c
Might be worth asking in #dagger. I don't use anvil... but maybe anvil could be of some help?
m
You can use hilt in libraries @kevindmoore. What you can’t do is to create a standalone component set for them easily. You’d have to do that on your own using the custom component features. And if you do that, then you run into an initialization problem. Something in the host app is going to have to initialize your singleton component on app startup, or process death will wreak havoc on you.
As a side note, we’re look at anvil as well, which is really nice, but does lack the component standardization that hilt has, as well as entry point injection. It’s really just a better way to gather up the required modules for any given component.
u
use anvil, its made for this