Background
I am converting my app to MVP architecture and found Dagger 2 to be useful to inject dependencies when needed. My app needs to communicat
I saw this thread after posting my answer to a similar question. I wanted to provide a link because I think the same approach could be useful depending on your situation. It may be overkill for this exact question but I wanted to share in case it helps someone else.
https://stackoverflow.com/a/52348744/5046784
In short you can create unique interfaces / classes for each named object(e.g. MyApiGson and ThirdPartyApiGson) and then create @Provides for those rather than the generic Gson class. This way you can inject the instances by class/interface rather than a magic string name that you need to lookup or remember. Its a little more work but it helps when you have a bunch of independent modules that provide difference instances of the same Class.