Hilt provides a standard way to incorporate Daggerdependency injection into an Android application.
The goals of Hilt are:
Hilt works by code generating your Dagger setup code for you. This takes awaymost of the boilerplate of using Dagger and really just leaves the aspects ofdefining how to create objects and where to inject them. Hilt will generate theDagger components and the code to automatically inject your Android classes(like activities and fragments) for you.
Hilt generates a set of standard Android Dagger components based off of yourtransitive classpath. This requires marking your Dagger modules with Hiltannotations to tell Hilt which component they should go into. Getting objects inyour Android framework classes is done by using another Hilt annotation whichwill generate the Dagger injection code into a base class that you will extend.For Gradle users, extending this class is done with abytecode transformation under the hood.
In your tests, Hilt generates Dagger components for you as well just like inproduction. Tests have other special utilities to help with adding or replacingtest bindings.