A (K)night with Dagger - Slicing problems of newbies
summary
Rebuilds a RandomUser Android app with Dagger 2 and shows concrete code: creates ApplicationComponent and MainActivityComponent, modules for Picasso, HTTP/file cache, Context and RandomUserService, and uses @Module/@Provides, @Component, @Scope and @Named/qualifier to resolve application vs activity context. Demonstrates field and constructor injection, component builder generation, and subcomponent/dependency wiring; explains Dagger1’s reflection cost versus Dagger2’s annotation processors and compile-time generation, and notes Gradle/stacktrace pain points that are resolvable.
AI-written summary · about
chapters (22)
- 0:00Introduction to Dagger
- 2:31Dependency injection basics
- 5:12Reflection and Dagger 1 vs 2
- 7:18Dagger 2 and annotation processors
- 8:02Modes of dependency injection
- 9:23Converting app to Dagger 2
- 12:13Refactoring for testability
- 14:04Dependency graph creation
- 15:09Modules and components
- 17:44Handling external dependencies
- 20:39Connecting modules to components
- 21:28Component builders and instances
- 22:53Scopes in Dagger
- 24:17Singleton scope implementation
- 25:23Context differentiation
- 27:52Activity-level dependencies
- 28:57Subcomponents and scopes
- 30:47Changes in application and activity
- 32:14Field injection vs constructor injection
- 34:51Constructor injection demo
- 35:57Dagger ease and challenges
- 37:10Q&A on reflection and errors
related talks
45mDagger 2 - Back to Basics
29mForging the Dagger for the modern Android world
25mDagger 2 Android : Defeat the Dahaka
38mDagger 2, 2 Years Later
27mUsing Dagger2 to Keep Android SDK Dependencies Clean
30mPowering up Dagger for Less Code and Cleaner Architecture
22mDependency Injection in Android using Dagger 2
48mDemystifying Dagger
