# android-architecture


11/17/2021, 9:27 PM
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?


11/17/2021, 10:23 PM
I got the impression that you couldn't use Hilt in libraries. I had to just use Dagger

Colton Idle

11/18/2021, 5:18 AM
Might be worth asking in #dagger. I don't use anvil... but maybe anvil could be of some help?


11/18/2021, 1:42 PM
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.


11/21/2021, 3:06 PM
use anvil, its made for this