# android-architecture


10/14/2020, 9:15 AM
Good morning I have a question regarding architecture, I have a multi-module project and I'm wondering how can I split the network module, I mean I don't want to create a difference instance of Retrofit everytime so do you know an efficient way to use the same instance of Retrofit if possible but changing the service? And also is ok to create the network module and inside of it every service? Or every service we should create inside the feature module? Because the problem is about the models. Anyone of you have worked with something similar? Thanks.


10/14/2020, 10:03 AM
You can share the same instance of Retrofit, just inject it to all modules where it needed
the network module and inside of it every service
It will be a huge mess, essentially all API-related code will be there, including all models, and everyone will depend on it
we have about 200 modules, we have limited amout iof Retrofit instances (like different Retrofit for files, web sockets etc), create service interface only in related modules


10/14/2020, 10:07 AM
How do you share services between features? For instance, if you have a home feature, how do you call Feature1 from that home feature if Feature1 has its own module and its own service inside of it. I mean if I create all of the featureService inside of each feature module how do you use it from different feature?
Well the question is, what happens when you need to do from Feature1 a call to a service from Feature2, I. know if I have to do this is a bad architecture or something, but always can happen how you solve this issue?


10/14/2020, 11:47 AM
You can divide your feature2 in multiple modules and get the useCase in Feature1 o move that useCase to a common/shared module


10/14/2020, 11:58 AM
Yes, that's what I thought... like splitting the modules for that
Let's see another options thanks for answering Javier