I have two working android application module A & B as same Android studio project. Each of them can be builded & run individually. But if I add module A as a 'module dependance' by specifying

implementation project(':appA') // in build gradle of app B

into module B then build is failing with following errors

ERROR: Unable to resolve dependency for ':appB@debug/compileClasspath': Could not resolve project :appA.
Show Details
Affected Modules: appB

ERROR: Unable to resolve dependency for ':appB@debugAndroidTest/compileClasspath': Could not resolve project :appA.
Show Details
Affected Modules: appB

ERROR: Unable to resolve dependency for ':appB@debugUnitTest/compileClasspath': Could not resolve project :appA.
Show Details
Affected Modules: appB

ERROR: Unable to resolve dependency for ':appB@release/compileClasspath': Could not resolve project :appA.
Show Details
Affected Modules: appB

ERROR: Unable to resolve dependency for ':appB@releaseUnitTest/compileClasspath': Could not resolve project :appA.
Show Details
Affected Modules: appB

Each of them work perfectly fine when build and run individually. The build tool was 'com.android.tools.build:gradle:3.2.1', supportLibraryVersion = '27.1.1' (for both module) & settings.gradle file have include ':appA', ':appB' in it.

I've also tried changing the 'application' plugin of module A to 'library' (as shown below)

apply plugin: 'com.android.library' // by removing applicationId too

but the result was same.

Am I missing anything or it's simply impossible to have an application modules as a module dependence in other module in same project?

Our requirement is that we have two application which actively being developed by two different team and one main application should have the total functionality of other application where the user should be able to switch fucationality without the need of downloading the second application. Thank you

1

There are 1 best solutions below

0
On

add dependency of module A in build gradle of module B like this:

   dependencies { api project(':appA')}

In settings.gradle also add

include ':appA'