accompanist icon indicating copy to clipboard operation
accompanist copied to clipboard

[Pager] Issues with Hilt enableAggregatingTask feature

Open mariobat88 opened this issue 5 years ago • 1 comments

Describe the bug

This is a compilation bug with Hilt version 2.37 and accompanist 1.12.0. In my app.gradle file I enabled

hilt {
    enableAggregatingTask = true
}

To Reproduce

Steps to reproduce the behavior:

  1. Use hilt version 2.37
  2. Add accompanist "com.google.accompanist:accompanist-pager:0.12.0"
  3. Sync Gradle
  4. Try to launch the app

Expected behavior

Everything would build and the app would launch normally

Screenshots?

If applicable, add screenshots to help explain your problem.

Environment:

  • Android OS version: [Android 11.0]
  • Device: [Emulator Google Pixel 5]
  • Accompanist version: [0.12.0]

Additional context

Stacktrace:

Execution failed for task ':app:hiltAggregateDepsDevDebug'.
> Could not resolve all files for configuration ':app:hiltCompileOnlyDevDebug'.
   > Could not resolve io.github.aakira:napier:1.4.1.
     Required by:
         project :app > com.google.accompanist:accompanist-pager:0.12.0
      > The consumer was configured to find attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'version' with value 'dev'. However we cannot choose between the following variants of io.github.aakira:napier:1.4.1:
          - commonMainMetadataElements-published
          - debugApiElements-published
          - debugRuntimeElements-published
          - iosArm64ApiElements-published
          - iosArm64MetadataElements-published
          - iosX64ApiElements-published
          - iosX64MetadataElements-published
          - jsApiElements-published
          - jsRuntimeElements-published
          - jvmApiElements-published
          - jvmRuntimeElements-published
          - metadataApiElements-published
        All of them match the consumer attributes:
          - Variant 'commonMainMetadataElements-published' capability io.github.aakira:napier:1.4.1:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'kotlin-api' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'common' but the consumer didn't ask for it
                  - Doesn't say anything about version (required 'dev')
          - Variant 'debugApiElements-published' capability io.github.aakira:napier:1.4.1 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
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - 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
                  - Doesn't say anything about version (required 'dev')
          - Variant 'debugRuntimeElements-published' capability io.github.aakira:napier:1.4.1 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
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - 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
                  - Doesn't say anything about version (required 'dev')
          - Variant 'iosArm64ApiElements-published' capability io.github.aakira:napier:1.4.1:
              - 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')
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'kotlin-api' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.native.target 'ios_arm64' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'native' but the consumer didn't ask for it
                  - Doesn't say anything about version (required 'dev')
          - Variant 'iosArm64MetadataElements-published' capability io.github.aakira:napier:1.4.1:
              - 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')
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'kotlin-metadata' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.native.target 'ios_arm64' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'native' but the consumer didn't ask for it
                  - Doesn't say anything about version (required 'dev')
          - Variant 'iosX64ApiElements-published' capability io.github.aakira:napier:1.4.1:
              - 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')
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'kotlin-api' 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
                  - Doesn't say anything about version (required 'dev')
          - Variant 'iosX64MetadataElements-published' capability io.github.aakira:napier:1.4.1:
              - 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')
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'kotlin-metadata' 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
                  - Doesn't say anything about version (required 'dev')
          - Variant 'jsApiElements-published' capability io.github.aakira:napier:1.4.1:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'kotlin-api' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.js.compiler 'legacy' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'js' but the consumer didn't ask for it
                  - Doesn't say anything about version (required 'dev')
          - Variant 'jsRuntimeElements-published' capability io.github.aakira:napier:1.4.1:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'kotlin-runtime' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.js.compiler 'legacy' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'js' but the consumer didn't ask for it
                  - Doesn't say anything about version (required 'dev')
          - Variant 'jvmApiElements-published' capability io.github.aakira:napier:1.4.1:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-api' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'jvm' but the consumer didn't ask for it
                  - Doesn't say anything about version (required 'dev')
          - Variant 'jvmRuntimeElements-published' capability io.github.aakira:napier:1.4.1:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'jvm' but the consumer didn't ask for it
                  - Doesn't say anything about version (required 'dev')
          - Variant 'metadataApiElements-published' capability io.github.aakira:napier:1.4.1:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'kotlin-metadata' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'common' but the consumer didn't ask for it
                  - Doesn't say anything about version (required 'dev')
        The following variants were also considered but didn't match the requested attributes:
          - Variant 'releaseApiElements-published' capability io.github.aakira:napier:1.4.1:
              - 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 version (required 'dev')
          - Variant 'releaseRuntimeElements-published' capability io.github.aakira:napier:1.4.1:
              - 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 version (required 'dev')`

mariobat88 avatar Jun 30 '21 10:06 mariobat88

Looks like Hilt's plug-in doesn't support handling KMP dependencies (Napier is KMP). Please raise a bug over on the Dagger tracker.

chrisbanes avatar Jul 01 '21 07:07 chrisbanes