Hello community! I would like to get your advices ...
# android-architecture
j
Hello community! I would like to get your advices about that I have a multi-modular android project. It has modules such as:
Copy code
--Module-app
--Module-core
--Module-feature
  |--SubModule-home
  |--SubModule-food
     |--SubSubModule-pasta
  |--SubModule-driver
My question is that How can I inject
SubSubModule-pasta
into
SubModule-food
without adding
implementation(…)
into gradle of
SubModule-food
? Basically, I do not want to have dependencies between sub-modules but I would like to access. Thank you!
s
Lift those things into a 3rd module which both -food and -home can see
j
Could you explain more? And I updated my question, forgot to add
subsubmodule
.
s
In order to have access to code from some module, you need to depend on that module, so if -food needs to know about something that is inside -pasta, then you need to depend on -pasta through
implementation
or
api
.
j
I see your point and agreed with you. I look for that can I use
-pasta
in
-food
without importing. I think, this is not possible because if I do not import
-pasta
, I cannot define property type in
-food
. If there is any other option, feel free to share!
l
You can create an interface in food, then implement it in pasta. Something higher up (ideally the final app module) would depend on pasta, and would pass instances into food.
3