Your next career begins with
Save 50% off your seat in our next iOS Bootcamp. Limited time only. Sessions start April 3.
Dagger by Tutorials
Version history
First Edition · Android 11, Kotlin 1.4, AS 4.1 (Selected)
Feb 12 2021First Edition - Early Access 1 · Android 11, Kotlin 1.4, AS 4.1
Nov 20 2020Learn dependency injection — an important technique for building software systems that are maintainable and testable. Dependency injection is nowhere near as complex as its name implies, and it becomes even easier by using Dagger — Google's framework that will help you solve development and performance issues that have plagued reflection-based solutions. By Massimo Carli.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Who is this for?
This book is for intermediate Kotlin or Android developers who want to know how to implement the dependency injection pattern with Dagger and Hilt libraries.
Covered concepts
- Dependency injection
- Dagger
- Injection types
- Advanced Dagger
- Hilt
Dependency injection is an important technique for building software systems that are maintainable and testable. You’re likely already doing dependency injection, maybe without even realizing it. Dependency injection is nowhere near as complex as its name implies, and this book will guide you through...
moreLearn about dependency injection with Dagger!
Dependency injection is an important technique for building software systems that are maintainable and testable. You’re likely already doing dependency injection, maybe without even realizing it. Dependency injection is nowhere near as complex as its name implies, and this book will guide you through everything you need to know!
This book will guide you through Dagger, Google’s framework for Java, Kotlin, and Android. Dagger will help you solve many of the development and performance issues that have plagued reflection-based solutions.
This book is for intermediate Kotlin or Android developers who want to know how to implement the dependency injection pattern with Dagger and Hilt libraries.
Before You Begin
This section tells you a few things you need to know before you get started, such as what you’ll need for hardware and software, where to find the project files for this book, and more.
Section I: DI Fundamentals
In this section, understand why you should use a dependency injection (DI) library like Dagger by learning all about the problem you need to solve: dependency.
You’ll understand what dependencies are and why you need to control them to create successful apps. You’ll get to know the Busso App, which you’ll work on, and improve throughout this book. And you’ll take your next step toward implementing better apps that are easier to test and modify.
Section II: Introducing Dagger
In this section, you’ll learn what Dagger is, how it works, and how it slashes the amount of code you need to write by hand when you implement dependency injection in your app.
You’ll learn how to deal with constructor, field and method injection with Dagger, how to simplify the implementation of @Module by using @Binds in cases when you have abstraction and its implementation, and how to use @Singleton to solve a very common problem.
Section III: Components & Scope Management
In this section, you’ll migrate the Busso App from the homemade framework to Dagger. In the process, you’ll learn how to migrate the existing ServiceLocators and Injectors to the equivalent Dagger @Modules and @Components, how to provide existing objects with a customized Builder for the @Component using @Component.Builder, and how to use @Component.Factory as a valid alternative to @Component.Builder.
The first migration will not be optimal — there will still be some fundamental aspects you will improve.
Section IV: Advanced Dagger
In this section, you’ll dive deeper into the advanced features of Dagger like multi-binding. Multibinding is a very interesting feature of Dagger because it simplifies the integration of new features using a plugin pattern you’ll learn in this section.
You’ll implement a simple framework that allows you to integrate new services in the Busso app in a very simple and declarative way. You’ll learn all you need to know about multi-binding with Set and Map.
Section V: Introducing Hilt
In the last section, you’ll learn everything you need to know about Hilt. Hilt is a dependency injection library for Android that reduces the boilerplate of doing manual dependency injection in your project.
Hilt is built on top of the DI library Dagger to benefit from the compile-time correctness, runtime performance, scalability, and Android Studio support that Dagger provides.
Section VI: Appendices
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development — plans start at just $19.99/month! Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.
Learn more