Home » Android » Multiple Android Application Modules Under One Project-Exceptionshub

Multiple Android Application Modules Under One Project-Exceptionshub

Posted by: admin February 26, 2020 Leave a comment


I have two ‘android application modules’ in one project and they create independent apks.
But I want to combine these two modules into one hence creating dependencies between the modules so that one apk can be generated and one ‘android application module’ can invoke activities from another ‘android application modules’.

Most of the examples suggests me to convert one ‘android application module’ into a ‘library module’ but I don’t want to do that.

Document here suggests that there can exist more than one ‘android application module’ in one project but never could I find an example that does that.

Please suggest some ideas.

How to&Answers:

So guys I figured the right way to handle this problem.

So I created a placeholder library module under the project that had 2 android application modules and modified the build.gradle(i.e. I introduced android SourceSet objects) of that library module to point to sources(src and res folders) of the other application module that I wanted to merge into other application module.

In this way both the application module may coexist under the same project and you never have to touch your application module(that you wanted to convert to a library module).

The only difference would be that the manifest file of this library module will not be having a ‘LAUNCHER’ intent filter for any of its activity since an application module can not have more than one LAUNCH activities.

So this way you can still have 2 independent apks and continue to develop the applications independently and if you want to include one in the other then use a placeholder library module to point sources of the app modules.


Each application module creates a separate APK. What you may want to do is to create a library module to contain code common to both APKs and then add a dependency between them.