Reputation: 750
so I have a couple of features that share common code - let's call them "feature1" and "feature2". I can't add the shared code as dependencies for "feature1" and "feature2" - Android studio throws the following error:
Multiple APKs packaging the same library can cause runtime errors. Adding the above library as a dependency of the base module will resolve this issue by packaging the library with the base APK instead.
So I thought I just create another dynamic feature module - let's call it "core" - to deliver the shared dependencies there. Which also works, kind of. I can access all the java classes from "core" inside "feature1" and "feature2", but as soon as I want to access a resource I get an ResourceNotFoundException. The features are deliver Fragments that call SplitCompat.install(context)
in their onAttach()
function.
So my question is - is it even possible to have a dynamic feature module where common code is stored, or should this all go in the app?
Thanks & Regards, Romanski
Upvotes: 3
Views: 5003
Reputation: 1995
Now support for feature on feature dependencies have been introduced in the 4.0 release of AGP:
Upvotes: 5