I have a general question regarding `multi-module ...
# android-architecture
I have a general question regarding
multi-module project
and utilizing a
DI library
. In particular I think about KOIN as DI library. You have to instruct your application somehow to load all koin modules (not gradle modules) to build the dependency graph. One option to achieve this, is to create a separat gradle module, lets call it di which is aware of all other gradle modules, so the app module can simply depend on it and can load the koin modules from there. Further, I came up with idea to put all koin modules in di gradle module rather than let every gradle module provide its koin module. The advantage is that all other gradle modules are independent of a DI library but the disadvantage is that almost every class of the other gradle modules has to be public so that di module is aware of the references. My question is: which approach would you choose and why? I tend to let the other gradle modules provide their koin modules, what do you think guys?
I have every gradle module also expose a koin module. Then my app module depends on every other gradle module and assembles all the koin modules before doing
. I haven't found a way to make all my feature modules to be unaware of koin. Specifically, sometimes I need my presentation modules to use specific features of koin (for example my Composables need to call
etc). Instead I try to make individual classes to know less about the DI library being used. I try to limit myself to using constructor injection as far as possible - then (as long as I don't use annotations), these classes have no knowledge of what DI library is being used. Only the koin DI related code does.
Thanks for sharing your experience. Thats almost the status quo what I have done