Adding enableAggregatingTask breaks build
See original GitHub issueVersions:
- 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:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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
.Closing as the fix for this was released in 2.38