0

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

Niroshan
  • 1,174
  • 1
  • 12
  • 30
  • Possible duplicate of [How to combine one android studio project into another android studio project](https://stackoverflow.com/questions/33528400/how-to-combine-one-android-studio-project-into-another-android-studio-project) – hossam scott Nov 12 '18 at 10:59
  • I also have issue converting one as library(mentioned already). And my requirement is to have two different stand-alone application & one will be a superset kind of another so can't just make one as library while both are being developed actively and being chnaged by different teams. – Niroshan Nov 12 '18 at 11:05
  • add :appA in your settings.gradle file – Milan Pansuriya Nov 12 '18 at 11:13
  • Added already include ':appA', ':appB' – Niroshan Nov 12 '18 at 11:16

1 Answers1

0

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

   dependencies { api project(':appA')}

In settings.gradle also add

include ':appA'
Sultan Mahmud
  • 1,245
  • 8
  • 18