Dagger + Anvil: Learning to Love Dependency Injection
summary
Anvil is a Kotlin compiler plugin that removes almost all Dagger module boilerplate by generating bindings from annotated classes, using merge component and contributes to app scope to wire modules by scope instead of manual includes. Real repos convert 98–99% of modules away, add custom generators for Retrofit and ViewModel APIs, and measure faster builds (average ~16% faster, single-module gains up to 65%) while preserving Dagger’s compile-time safety.
AI-written summary · about
chapters (7)
- 0:00Introduction
- 7:10Dagger basics refresher
- 13:54Introducing Anvil
- 21:14Why not Hilt?
- 26:13Build time optimizations
- 31:10Custom code generation
- 35:42Conclusion and Q&A
related talks
30mExtending kotlin-inject for fun & profit
40mNavigating Dependency Injection with Metro
35mDIY Dependency Injection with Kotlin
38mExtending kotlin-inject for fun & profit
29mDIY Dependency Injection with Kotlin
27mUsing Dagger2 to Keep Android SDK Dependencies Clean
47mSimple Dependency Management in Kotlin
40mNavigating Dependency Injection with Metro
