Dagger hilt support for Library Application

Viewed 1033

I want to develop an android library that contains no UI/ViewModel. It will have the business logic only. There will be another application that would use this library application. As per this documentation

All apps that use Hilt must contain an Application class that is annotated with @HiltAndroidApp.

Also, Hilt currently supports the following Android classes:

 - Application (by using @HiltAndroidApp) 
 - Activity 
 - Fragment 
 - View 
 - Service
 - BroadcastReceiver

Below are the queries:

  1. Library will not have such classes that contain the Application class. In this case, how to use Hilt with the Library(Without making any dependency on an application that will use this library)?

  2. Library will not have any UI/ViewModel and will have the core logic only. In this case, Can Hilt be used for dependency injection? If yes, how to inject the same?

0 Answers
Related