Reputation: 17735
I have an application class MainApplication
I need to access to a Hilt module in this class:
How can I achieve this ?
Upvotes: 1
Views: 1959
Reputation: 1068
@HiltAndroidApp
class MainApplication : MultiDexApplication() {
@Inject
lateinit var hceRepository: HceRepository //new
override fun onCreate() {
// Try to call anything of hceRepository in here.
}
}
Do the field injection in the Application class. This should be enough
Upvotes: 5