Dagger 2
List of resources to learn aboutWhy you need dependency injection
-
D is for the Dependency Inversion Principle
All SOLID Principles are essential in understanding in how to write better and maintanable code. This series of articles by Donn Felker has the best explanations of all SOLID principles. -
More About Dependency Inversion Principle
-
Robert C. Martin - Clean Architecture
This talk by Bob Martin is essential to every software dev learning to write good testable code.
Dependency Injection and Dagger Basics
-
Dagger 2 Beginner Tutorial [Youtube Playlist]
One of the best tutorials explaining dependency injection and all the annotations involved with live examples from an android app from scratch. -
Dagger 2 for Android Beginners — Introduction [Article Series]
A great intro and series on DI made exciting with explanations using Game of Thrones. -
Dagger 2 Basics
A very well written article which explains all the parts used in Dagger along with many best practices as well. Must read after basics of Dependency Injection are clear. -
Articles by Mirek Stanek
- Dependency injection with Dagger 2 - Introduction to DI
- Dependency injection with Dagger 2 - the API
- Dependency injection with Dagger 2 - Custom scopes
Excellent explanations from the author. Clearly explained with code examples along with an example of how Dagger can be used in the android context.
-
Dependency Injection Android Using Dagger2 [Article Series]
Beautifully and simply explained. -
Take a Stab at Test-Friendly Architecture with Dagger 2
Why you need Dagger and where it fits in and what are its benefits
Dagger best practices
- Keeping the Daggers Sharp ⚔️
A great read on some of the best practices for Dagger - That Missing Guide: How to use Dagger2
- It's complicated, but it doesn't have to be: a Dagger journey by Fred PorciĂşncula, Blinkist EN
An excellent talk explaining latest Dagger best practices. - Dagger 2 – Rules of Engagement
- Inject interfaces without provide methods on Dagger 2
Dagger Android modules
-
[Youtube] Valentin Hinov - Understanding Dagger 2 on Android
-
Mert ĹžimĹźek
-
James Shvarts
-
Ahsen Saeed
Advanced Dagger Blogs
- [Youtube] Optimizing Dagger on Android: Developer Workflow and Runtime Performance
Slides - Repository layer using Room and Dagger 2 — Android
- Low Coupling With Rx and Dagger 2 in Android
- When the Avengers meet Dagger2, RxJava and Retrofit in a clean way
- MVVM architecture, ViewModel and LiveData — Part 2 (DI)
- Background Work with Android Job and Dagger
- Realm Migrations Supercharged with Dagger
- Retaining Dagger components across configuration change using Service-Tree
- Marinator: Delicious Dependency Injection
- Dagger 2 Generated Code
- RxPreferences and Dagger
- Providing Interface Implementations with Dagger
Testing
- Dagger 2 Android playground: Let’s play with different configurations and tests
- Fast and reliable UI tests on Android
- Providing test doubles with Dagger 1 and Dagger 2
- IdlingResource, Dagger and Junit rules
- Android testing using Dagger 2, Mockito and a custom JUnit rule
- Using Dagger For Testable Code
- How Dagger 2 Helps In Android Espresso Tests
- Activity Espresso Test With Dagger’s Android Injector
- Fragment Espresso Testing With Dagger’s Android Injector
- DaggerMock - A JUnit rule to easily override Dagger 2 objects
With Kotlin
- Moving from Dagger to Koin — Simplify your Android development
- Better dependency injection for Android
- Dagger 2 in only 4 code lines
- Dagger 2 for Dummies in Kotlin (with 20 lines of code)
- MVP Architecture with Kotlin — Dagger 2, Retrofit, RxAndroid and DataBinding
- Unit tests with JUnit on a Kotlin project with Dagger 2, Retrofit and RxAndroid
Videos
- Android Dialogs, Pierre-Yves Ricau - Dagger
- Dagger 2 - A New Type of dependency injection
- The Future of Dependency Injection with Dagger 2 - Jake Wharton
- Dependency Injection with Dagger 2 - Brandon Gogetap
- Dependency Injection Using Dagger 2 - Patrick Hammond
- Architecting Android Applications with Dagger - Jake Wharton
- Understanding Dagger 2's Codegen implementation by Gregory Kick
- Mike Nakhimovich: Dagger 2: @Reusable, static @Provides, scopes
- Dagger 2 @ Pandora
- 360|AnDev 2016 - Daniel Lew: Dependency Injection Made Simple
- Inject with Dagger by Mateusz Herych
- Understanding Dagger 2's Generated Code by Ron Shapiro & David P. Baker
- Swordfighting with Dagger by Mike Nakhimovich
- Dagger Slidenerd Tutorials
- Dagger on Android in 2018 - Ben Kay, software engineer at Citymapper
- Dagger 2.2 - CodingWithMitch
- Advanced Dagger 2 Tutorial (Video)
- [Youtube] Dependency Injection in Android - Best Practices by Vasiliy Zukanov
Podcasts
Paid Courses
- [Castor IO] - Dependency Injection with Dagger 2
- [Udemy] - Dependency Injection in Android with Dagger 2 by Vasiliy Zukanov
- [Udemy] - Advanced Android - Architecture with Dagger 2 and more
- [Udemy] - Architect Android apps with MVP, Dagger, Retrofit & RxJava
Github repos
- https://github.com/Karumi/KataSuperHeroesAndroid
- https://github.com/googlesamples/android-architecture/tree/todo-mvp-dagger/
- https://github.com/iammert/dagger-android-injection
- https://github.com/Ekito/koin
- https://github.com/hitherejoe/MvpBoilerplate
- https://github.com/ribot/android-boilerplate
- https://github.com/androidstarters/generator-android-mvp-starter
- https://github.com/gk5885/dagger-android-sample
- https://github.com/android10/Android-CleanArchitecture
Tools
Stackoverflow Questions to go through
- How to set up DAGGER dependency injection from scratch in Android project?
- Dagger 2 subcomponents vs component dependencies
- What determines the lifecycle of a component (object graph) in Dagger 2?
- Dagger- Should we create each component and module for each Activity/ Fragment
- How do you override a module/dependency in a unit test with Dagger 2.0?
- Android Unit Tests with Dagger 2
- Dagger2 Custom Scopes : How do custom-scopes (@ActivityScope) actually work?
- How do you organise your Dagger 2 modules and components?
- Dagger 2 Custom Scope for each Fragment (or Activity etc…)
- How do you override a module/dependency in a unit test with Dagger 2.0?
- Dagger 2 scope and subcomponents
- Dagger 2 error: dependency “cannot be provided without an @Inject constructor” while it actually annotated with @Inject
- Scopes in Dagger 2
- Problems with singletons when using component dependencies
- How do different retention policies affect my annotations?
- What's the difference between interface and @interface in java?