13

Dependency Injection with Dagger, Hilt, and Koin

This chapter covers the concept of dependency injection and the benefits it provides to an Android application. We will look at how we can perform dependency injection manually with the help of container classes. We will also cover some of the frameworks available for Android, Java, and Kotlin that can help developers when it comes to applying this concept. By the end of this chapter, you will be able to use Dagger 2 and Koin to manage your app’s dependencies and know how to organize them efficiently.

In the previous chapter, we looked at how to structure code into different components, including ViewModels, API components, and persistence components. One of the difficulties that always emerged ...

Get How to Build Android Apps with Kotlin - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.