Setting Up Android Modules with Koin
Published in
4 min readSep 23, 2019
Previously, I experimented setting up Dagger 2 on an Android project with multiple modules. You could find that article below:
Since then, I’ve wondered how Koin would work for a multi-module Android project. The topic is debated on Reddit as a service locator instead of dependency injection. Regardless, they both are pretty similar and could achieve the same thing if done properly.
Let’s look at how it is done here.
Project Assumptions
Here’s how we’ll set up our simple project:
- There are three activities, where
MainActivity
could launchFeatureOneActivity
orFeatureTwoActivity
- Each of the activities has its own dependency injected to it
- Each of the dependencies is injected with a singleton network and repository (i.e., the same copy is injected to all dependencies)