This repository shows how to use Dagger in an Android project. There are several packages representing incremental steps on how to (and not to) integrate Dagger.
Initial code without Dagger
Naive Dagger usage. The application crashes with configuration changes and app reinstantiation
Simple and older solution using member injection
Usage of dagger-android lib to help with member injection on android components
Usage of dagger-android and improving the code with lifecycle components listening
Constructor injection and simple solution with Fragment Factory (and without dagger-android)
Single Fragment Factory for every fragment but poor key
Single Fragment Factory for every fragment with @FragmentKey
Providing context using @Component.Factory
Providing ViewModel using ViewModelProvider.Factory
Activity member injection
Activity constructor injection (api 28+)