0

I have a main app module that depends on 2 sub modules, lets say A and B. In both A & B there exists Application classes that need to be implemented in my main Application class.

How do I go about this?

The only way I think this is possible will be to use multiple inheritance which is not allowed in Java.

I have looked at the following solutions:
1. how to handle multiple application classes in android
2. how to have multiple application classes in separated jars in one application in android

But these pertain to a hierarchical dependency between modules, i.e, A->B->C. However my case involves A->B & C.

Any help is greatly appreciated!

  • Please explain in more detail these dependencies. Give us an example of something that needs to be implemented in your `Application` class. – David Wasser Aug 03 '23 at 10:27
  • If your dependencies A and B both require that you create an `Application` class that is a subclass of their `Application` class, then there is probably no way to implement this, unless you have source code for both A and B's `Application` class, in which case it may be possible to implement this using delegation. – David Wasser Aug 03 '23 at 10:30
  • Hi @DavidWasser, the main idea I was going for was to implement manual dependency resolution to create required classes for higher modules. Also, we do have access to module A & B's source code. – Damian Ablett Aug 04 '23 at 04:18
  • Sorry, I don't understand. Please edit your question and explain how your `Application` class is "dependent" on these other classes. And I don't understand your use of the term "module". This can mean almost anything. Please be more specific. Edit the question and post code that shows the problem. – David Wasser Aug 04 '23 at 09:43

0 Answers0