Rex - From Dagger to Dagger Hilt
summary
Migrating a Dagger app to Hilt proves practical: setup from scratch uses @HiltAndroidApp on Application and @AndroidEntryPoint on Activities/Fragments, ViewModels use @HiltViewModel and constructor injection, and modules use installIn(SingletonComponent) or activity/view components. Built a refactor that removes custom components, fixes scopes, and adds WorkerFactory + getWorkManagerConfiguration for workers. Watch for gotchas: fragments must run in Hilt activities, ViewModel parent is retained activity so no activity context, dynamic features and UI tests need extra work, and build-time checks catch most migration errors.
AI-written summary · about
chapters (21)
- 0:00Introduction
- 0:36Context
- 1:45Dependency Injection
- 2:37Dagger
- 4:42Dagger Hilt
- 5:17Singleton Component
- 5:55Bindings
- 6:17How does it work
- 6:51Fragments services
- 7:23Modules
- 9:12Worker
- 9:59Research
- 11:16Refactoring
- 12:50Migration Guide
- 13:24Application Migration
- 15:14Health Activities
- 15:43Annotation
- 15:57Default bindings
- 16:22Binding naming
- 16:36Retained activity
- 17:37Take away
related talks
25mFully Understanding Dagger Hilt Migration from First Principles
45mDagger Hilt: Live Code Tutorial, Pros and Cons
32mUsing Hilt in a Multi-Module Project
44mHilt: Dependency Injection for the mere mortals
42m(Unofficial) Guide to App Architecture Guide Vol. 2
39mManaging state beyond ViewModels and Hilt
41mA (K)night with Dagger - Slicing problems of newbies
47mUp to Date? Talking About Your App
