question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding enableAggregatingTask breaks build

See original GitHub issue

Versions:

  • Android Studio: 4.2.1
  • AGP: 4.2.1
  • Dagger: 2.37

We have a Kotlin Multiplatform Module called common, which is then referenced from Android and iOS. In the Android app we include this common module. The app builds fine without the following code in build.gradle:

hilt { enableAggregatingTask = true }

As soon as I add it, the next build after the Gradle sync fails with the following error:

Could not determine the dependencies of task ':android:app:hiltJavaCompileRtvNoordDebug'.
> Could not resolve all task dependencies for configuration ':android:app:hiltCompileOnlyRtvNoordDebug'.
   > Could not resolve project :common.
     Required by:
         project :android:app
      > The consumer was configured to find attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'omroep' with value 'rtvNoord'. However we cannot choose between the following variants of project :common:
          - debugApiElements
          - debugRuntimeElements
          - iosApiElements
          - iosDefault
          - iosRuntimeOnly
          - metadataApiElements
          - metadataDefault
        All of them match the consumer attributes:
          - Variant 'debugApiElements' capability nl.stichtingrpo.news.common:common:1.0 declares attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug':
              - Unmatched attributes:
                  - Provides com.android.build.api.attributes.VariantAttr 'debug' but the consumer didn't ask for it
                  - Doesn't say anything about omroep (required 'rtvNoord')
                  - Provides org.gradle.usage 'java-api' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'androidJvm' but the consumer didn't ask for it
          - Variant 'debugRuntimeElements' capability nl.stichtingrpo.news.common:common:1.0 declares attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug':
              - Unmatched attributes:
                  - Provides com.android.build.api.attributes.VariantAttr 'debug' but the consumer didn't ask for it
                  - Doesn't say anything about omroep (required 'rtvNoord')
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'androidJvm' but the consumer didn't ask for it
          - Variant 'iosApiElements' capability nl.stichtingrpo.news.common:common:1.0:
              - Unmatched attributes:
                  - Provides artifactType 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Doesn't say anything about omroep (required 'rtvNoord')
                  - Provides org.gradle.usage 'kotlin-api' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.localToProject 'public' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.native.target 'ios_x64' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'native' but the consumer didn't ask for it
          - Variant 'iosDefault' capability nl.stichtingrpo.news.common:common:1.0:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Doesn't say anything about omroep (required 'rtvNoord')
                  - Provides org.jetbrains.kotlin.localToProject 'local to :common' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.native.target 'ios_x64' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'native' but the consumer didn't ask for it
          - Variant 'iosRuntimeOnly' capability nl.stichtingrpo.news.common:common:1.0:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Doesn't say anything about omroep (required 'rtvNoord')
                  - Provides org.jetbrains.kotlin.native.target 'ios_x64' but the consumer didn't ask for it
          - Variant 'metadataApiElements' capability nl.stichtingrpo.news.common:common:1.0:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Doesn't say anything about omroep (required 'rtvNoord')
                  - Provides org.gradle.usage 'kotlin-api' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.localToProject 'public' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'common' but the consumer didn't ask for it
          - Variant 'metadataDefault' capability nl.stichtingrpo.news.common:common:1.0:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Doesn't say anything about omroep (required 'rtvNoord')
                  - Provides org.jetbrains.kotlin.localToProject 'local to :common' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'common' but the consumer didn't ask for it
        The following variants were also considered but didn't match the requested attributes:
          - Variant 'prereleaseApiElements' capability nl.stichtingrpo.news.common:common:1.0:
              - Incompatible because this component declares attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'prerelease' and the consumer needed attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
              - Other compatible attribute:
                  - Doesn't say anything about omroep (required 'rtvNoord')
          - Variant 'prereleaseRuntimeElements' capability nl.stichtingrpo.news.common:common:1.0:
              - Incompatible because this component declares attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'prerelease' and the consumer needed attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
              - Other compatible attribute:
                  - Doesn't say anything about omroep (required 'rtvNoord')
          - Variant 'releaseApiElements' capability nl.stichtingrpo.news.common:common:1.0:
              - Incompatible because this component declares attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
              - Other compatible attribute:
                  - Doesn't say anything about omroep (required 'rtvNoord')
          - Variant 'releaseRuntimeElements' capability nl.stichtingrpo.news.common:common:1.0:
              - Incompatible because this component declares attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
              - Other compatible attribute:
                  - Doesn't say anything about omroep (required 'rtvNoord')

omroep is a flavor, which is set to rtvNoord in the current build variant. nl.stichtingrpo.news.common:common is the package of the common module. Is this new setting not compatible with the 4.x versions of AGP or Kotlin Multiplatform? Let me know if you need any more info for resolving this.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
danysantiagocommented, Jul 8, 2021

@eric-labelle you seem to be having a different issue, can you file a new bug and share more information about your setup? Like your build.gradle and a trace running Gradle with --stacktrace.

0reactions
danysantiagocommented, Nov 4, 2021

Closing as the fix for this was released in 2.38

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to support modularization in Android app with HILT?
... apply below to your :app/build.gradle and remove the transitive module(s) dependencies from it. hilt { enableAggregatingTask = true }.
Read more >
Gradle Build Setup - Dagger
To use Hilt, add the following build dependencies to the Android Gradle module's build.gradle file: ... build.gradle : hilt { enableAggregatingTask = true...
Read more >
Build Lifecycle - Gradle User Manual
This example uses method Project.afterEvaluate() to add a closure which is executed after the project is evaluated (ie. the end of the configuration...
Read more >
Android Gradle Plugin 4.1.0 breaks build config field injecting ...
Run ./gradlew generateDebugBuildConfig; Build config field is not generated and added to result BuildConfig.java. Context. On our project we have a Gradle ...
Read more >
Dagger Hilt on Multi-Module Android App | by Elye - Medium
Then add the required library in the app's build.gradle ... The enableAggregatingTask = true will not work here, as the App Module needs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found