Fully Understanding Dagger Hilt Migration from First Principles
summary
A step-by-step migration from Dagger/Dagger Android to Hilt, demonstrated with a sample repo of four buildable commits. Covers concrete code edits: removing component factories, turning ApplicationComponent into EntryPoints backed by SingletonComponent, creating an aggregator module and moving modules into it, switching scope annotations and annotating activities/fragments with @AndroidEntryPoint, and removing DispatchingAndroidInjector. Also explains handling UI test issues (Robolectric, FCM, services) by replacing @AndroidEntryPoint with explicit EntryPoint lookups and guarded fallbacks, plus the Gradle/plugin configuration required for Hilt’s bytecode transformation.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 1:51Dagger fundamentals
- 4:18Dagger vs Dagger-Android
- 7:27Hilt approach
- 10:57Migration steps
- 11:59Component tree grafting
- 14:47Replacing scope annotations
- 15:49Migrating Activities
- 17:12Login migration
- 18:57Fragments migration
- 19:40Migration cleanup
- 20:01Common issues
- 24:13Hilt in UI testing
- 25:19Summary
related talks
45mDagger Hilt: Live Code Tutorial, Pros and Cons
22mRex - From Dagger to Dagger Hilt
32mUsing Hilt in a Multi-Module Project
44mHilt: Dependency Injection for the mere mortals
42m(Unofficial) Guide to App Architecture Guide Vol. 2
29mForging the Dagger for the modern Android world
25mDagger 2 Android : Defeat the Dahaka
41mA (K)night with Dagger - Slicing problems of newbies
