2

I've looked over Google's examples and codelabs and they look pretty simple but they are for modules that the main app access directly. My problem is that I have a module that the main app never access directly.

Basically I have this:

App -> Module A -> Module B -> Module C

So App imports A as a gradle implementation, A imports B and B imports C.

I want C, that is rarely used and large, to be a dynamic module.

I've already set C to be apply plugin: 'com.android.dynamic-feature' but I'm getting stuck on the dependencies.

If I set dynamicFeatures = [':C'] inside the gradle file of B, it fails because Could not set unknown property 'dynamicFeatures' for object

If I set the dynamycFeatures plus the implement line on App I get Unable to resolve dependency for ':app@prodDebug/compileClasspath': Could not resolve project :C

So how do I do this with this project hierarchy?

Thanks.

casolorz
  • 8,486
  • 19
  • 93
  • 200
  • If "prodDebug" is a build type you have in the main module, make sure that you have that build type in all your modules. See if that solves the build issue. I had the same issue. – Dinesh Nov 18 '19 at 10:07
  • Any luck in getting the code built? – Dinesh Nov 19 '19 at 02:24

2 Answers2

1

Have you checked plaid? https://github.com/android/plaid

https://medium.com/androiddevelopers/a-patchwork-plaid-monolith-to-modularized-app-60235d9f212e They solved your problem using Reflection API

Yuri Popiv
  • 519
  • 4
  • 15
0

If "prodDebug" is a build type you have in the main module, make sure that you have that build type in all your modules. See if that solves the build issue. I had the same issue.

And In-General, you would have an app hierarchy where you would have one base module and the dynamic modules that you can plug-in into the base module. This has worked quiet successfully.

Dinesh
  • 948
  • 6
  • 11
  • Sorry, that didn't help, but maybe my setup is just too old since it predates android studio. I tried setting up a dynamic module and letting android studio do it and that still failed. – casolorz Nov 19 '19 at 20:33