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 playlist →

Subscribe to the Android Developers channel! →

Check out the photo album →


Read more all post Android Technology :
  1. Hossain in Motion says

    I can imagine the audience's frustration about hypothetical future of having better DI solution on Android.Well, now we have it, they were talking about "Dagger Hilt" it's here now.

  2. Char waka says

    dagger-android sucks !! but dagger is good , but i am going with KOIN

  3. Jason L says

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

  4. Sohail Shrestha says

    I use kodein. Its easy and painless.

  5. Michael Vescovo says

    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.

  6. vlastos says

    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

  7. Edwin Capidos says

    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.

  8. Gaurav bhola says

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

  9. Igor Ganapolsky says

    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.

  10. Gabriel Costa says

  11. Jalen Zheng says

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

  12. saied Vanguard says

    Why not just quit on dagger and invest in koin a bit?

  13. saied Vanguard says

    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.

  14. saied Vanguard says

    In short dagger still sucks in 2019. come back maybe in two years.

  15. Kirill says

    Bla bla bla. No support for Dagger + ViewModel yet.

  16. 100 Egyptian Things says

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

  17. darkknightsds says

    Koin > Dagger

  18. Pafo says

    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

  19. Adnaan Ahmed says

    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.

  20. Sana Ebadi says

    Should we learn dagger now?What's the replacement?learn koin?

  21. eatthepi says

    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.

  22. Jan Lukeš says

    Koin ftw, sorry dagger

  23. parag sarkar says

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

  24. Sindre Moen says

    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.

  25. Kris B says

    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.

  26. Aidan Mcwilliams says

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

  27. Frank D says

    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.

  28. tieskedh says

    General info DI/service-locator: tutorial:

  29. Peter Keefe says

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

  30. Hitesh Chalise says

    codelabs and better documentation is helpful, thanks 🙂

  31. Njim Houssem says

    I ♥ Dagger but it doesn't love me back 🙁

  32. paro8344 says

    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

  33. Ace Hardy says


  34. Захар Родионов says

    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.

  35. Stavro Xhardha says

    Lol, I knew he would show logaritmic function for Dagger

  36. Han Harry says

    anyone prefer koin?

  37. Minh Nhật says

    I'm using dagger in my project and it's great

  38. Nathan Schwermann says

    What about koin? Not worth even mentioning?

  39. Mat P says

    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.