I am experimenting with Android's Dynamic Feature Modules (a.k.a. on demand modules) on the side of the project I am working on.
In my PoC (proof-of-concept) project, Dynamic Feature Modules (DFM) work fine and gradle builds the project with no issue. After finishing with my PoC, I decided to apply it to an existing project. However, gradle failed building the project with:
Could not determine the dependencies of task ':my-app:checkSomeBuildFlavorDebugLibraries'.
> Could not resolve all task dependencies for configuration ':my-app:someBuildFlavorDebugMetadataValues'.
> Could not resolve project :features:myDynamicFeatureModule.
Required by:
project :my-app
> Cannot choose between the following variants of project :features:myDynamicFeatureModule:
- anotherBuildFlavorDebugAndroidTestCompile
- anotherBuildFlavorDebugAndroidTestRuntime
- ...
All of them match the consumer attributes:
- Variant 'anotherBuildFlavorDebugAndroidTestCompile' capability myproject.features:myDynamicFeatureModule:unspecified:
- Unmatched attributes:
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' but no value provided.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Metadata' but no value provided.
- Required endpoint 'someBuildFlavor' but no value provided.
- Found org.jetbrains.kotlin.localToProject 'local to :features:myDynamicFeatureModule' but wasn't required.
- Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
- Variant ...
Note that this error is quite long, iterating through all possible flavors.
What I have tried, but did not work:
implementation project(path: ':my-app', configuration: 'default')
and also configuration: 'someFlavor'
missingDimensionStrategy 'mydimension', 'myflavor'
What I have tried and it worked:
com.android.dynamic-feature
and kotlin-android
Notes:
Unfortunately I could not reproduce the problem in a separate project. I tried removing as much of things as possible from my project but I could not resolve the issue.
Do you have any idea what could be causing this issue and how could I possibly fix it? Thank you!
I had this issue and it was due to not removing the implementation project(':features:myDynamicFeatureModule')
line from my app module's gradle file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With