An Opinionated Guide to Dependency Injection on Android (Android Dev Summit '19)

Dagger has become the recommended way to do Dependency Injection on Android. However, there are many ways to use Dagger! Come hear why we recommend Dagger, best practices including recommended setup in multi-module projects and what plans we have to improve Dagger in Android so that you can create a solid, extensible solution for managing dependencies in your app that scales to large projects.

Presented by: Manuel Vivo, Daniel Santiago Rivera

Android Dev Summit ’19 all sessions…


  1. I love DI its one of the best patterns i have learned to use properly I'mn my programs

  2. I know this is for android but the future is multiplatform. Unless it will support multiplatform then it's not really an option long term.

  3. Please think about multi module! subcomponents in a singlemodule app is pretty nice and fluent, however it breaks in multimodule, especially if you want to contribute an instance to parent scope

  4. I'm a Xamarin.Forms developer but started with Xamarin.Android. I like the freedom you have with native but I kinda miss the Forms for MVVM Framework and Dependency Injection.

  5. YAY! Finally @InstallIn and pre-defined components coming in hot :).
    This will help make multi module apps super simple.

  6. I'd like to see more real-life sample repos of this approach by Google. Nobody is building a `Car` or `Thermosiphon` app in the real world like this.

  7. I am surprised no one mentioned Toothpick. I think it is better than koin, let alone Dagger.

  8. Its pretty astonishing that they start by stating that everyone should use dagger but then spend 15 minutes iterating on its many pain points and making vague promises about them. All the while ignoring koin completely.

  9. Well, All the links mentioned in the talks is not provided in videos' descriptions

  10. The codelab has an error on module 7, it doesn't compile successfully. This is the error it gives me -> @Binds methods' parameter type must be assignable to the return type

  11. It always confuses me. Guys how did you all manage to get this Cost vs App Size graph here at 6:06. Like what tool or methodology you take. I am asking because a presentation like this help me to onboard my team to pick something up but I always struggle in creating such data points.

  12. The difficulty of setting up integration tests with dagger has really limited the amount of integration tests that we write. I've looked at some libraries which try to make this easier, but haven't found anything that works well for us. Looking forward to whatever this effort produces.

  13. Can we please have DI as a part of jetpack feel setting up dagger on project takes lot of time

  14. Seriously, my biggest annoyance with Dagger is that everything has to be a “lateinit (public) var”. I want my dependencies to be private and I want them to not have mutable references. This is my biggest reason for using Koin, to be honest.

  15. It took me forever to wrap my head around what DI is then one day it clicked and I realized it's just passing a class into another class. Complex word for something simple.

  16. I don't get 'runtime surprises' with Koin because I verify the application dependency graph with simple tests.

  17. Oh my god, TestEntryPointRule. I've wanted to do exactly that for so long, but couldn't figure out why every attempt seemed like the wrong way to do it.

  18. What about val (or lazy val) support in Kotlin? Those lateinit vars can get a bit annoying

  19. Did they not add the Dagger documentation section? When I go to that link its really just tells me what DI is and when to use it, not helpful

  20. The dagger api is terrible and very confusing, even for experienced developers. Definitely need a new di tool. Koin is very good, and I use it for new projects, but it is still a service locator and this is its minus.

  21. Hope you will find an easy way to integrate with fragment factory and viewmodel factory. Because actually scoping them with dagger-android is nearly impossible. Nice talk 👍

Leave a Reply

Your email address will not be published. Required fields are marked *