title: Cannot choose between the following variants of project :features:myDynamicFeatureModule:
body: <p>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.</p>
  
  <p>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:</p>
  
  <pre><code>Could not determine the dependencies of task ':my-app:checkSomeBuildFlavorDebugLibraries'.
  
  &gt; Could not resolve all task dependencies for configuration ':my-app:someBuildFlavorDebugMetadataValues'.
     &gt; Could not resolve project :features:myDynamicFeatureModule.
       Required by:
           project :my-app
        &gt; 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 ...
  </code></pre>
  
  <p>Note that this error is quite long, iterating through all possible flavors.</p>
  
  <p>What I have tried, but did not work:</p>
  
  <ul>
  <li>I added exactly the same flavors that base module (my-app) has in my dynamic module</li>
  <li>In build.gradle of my DFM, I tried to set configuration explicitly like : <code>implementation project(path: ':my-app', configuration: 'default')</code> and also configuration: <code>'someFlavor'</code></li>
  <li>In build.gradle of the base module (my-app) I used <code>missingDimensionStrategy 'mydimension', 'myflavor'</code></li>
  <li>Building from Android Studio and also from terminal</li>
  <li>Removing dependencies and other code from build.gradle files</li>
  </ul>
  
  <p>What I have tried and it worked:</p>
  
  <ul>
  <li>Removing the dependency of base app (my-app) from DFM (i.e. removing implementation project(':my-app',) ) - but I need it. Just to clarify, the DFM applies the following gradle plugins: <code>com.android.dynamic-feature</code> and <code>kotlin-android</code></li>
  <li>Removing all flavors from the base app and DFM - but I need them in the base app.</li>
  <li>The PoC I made works fine and gradle compiles the project even with the same flavors I use in my actual project</li>
  </ul>
  
  <p>Notes:</p>
  
  <ul>
  <li>I use DexGuard (but I disabled it to make sure it isn't interfering)</li>
  <li>I don't have any custom build types, only 'debug' and 'release'</li>
  <li>Gradle version is 3.5.2</li>
  <li>Gradle wrapper is 5.5.1</li>
  <li>Both the PoC and my actual project use the same versions of gradle, gradle wrapper, build types and flavors</li>
  </ul>
  
  <p>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.</p>
  
  <p>Do you have any idea what could be causing this issue and how could I possibly fix it? Thank you!</p>