dependency-analysis-gradle-plugin icon indicating copy to clipboard operation
dependency-analysis-gradle-plugin copied to clipboard

Could not resolve project -> when a submodule is aar artifact

Open brianPlummer opened this issue 10 months ago • 2 comments

Build scan link

Plugin version 1.31.0

Gradle version 8.7

JDK version 17.0.6

(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version 1.9.23

(Optional) Android Gradle Plugin (AGP) version 8.3.2

Describe the bug ./gradlew app:projectHealth produces the output:

Could not determine the dependencies of task ':selfprofile:transformReleaseClassesWithAsm'.
> Could not resolve all task dependencies for configuration ':selfprofile:releaseRuntimeClasspath'.
   > Could not resolve project :laboratory-lib.
     Required by:
         project :selfprofile
         project :selfprofile > project :core-ui
         project :selfprofile > project :core-data
         project :selfprofile > project :core-common
      > The consumer was configured to find a library for use during runtime, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.3.2', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'. However we cannot choose between the following variants of project :laboratory-lib:
          - projectHealthElements
          - resolvedDepsElements
        All of them match the consumer attributes:
          - Variant 'projectHealthElements' capability Foo:laboratory-lib:unspecified:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.3.2')
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
                  - Doesn't say anything about its component category (required a library)
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about its usage (required runtime)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
                  - Provides attribute 'dagp.internal.artifacts' with value 'project-health' but the consumer didn't ask for it
          - Variant 'resolvedDepsElements' capability Foo:laboratory-lib:unspecified:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.3.2')
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
                  - Doesn't say anything about its component category (required a library)
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about its usage (required runtime)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
                  - Provides attribute 'dagp.internal.artifacts' with value 'resolved-deps' but the consumer didn't ask for it

To Reproduce Create a project with a submodule that is just an aar wrapper. With a build.gradle.kts like

configurations.maybeCreate("default")
artifacts.add("default", file("some.aar"))

Expected behavior ./gradlew app:projectHealth should output the health report

brianPlummer avatar Apr 23 '24 17:04 brianPlummer

Thanks for the report. Do you have a minimal reproducer?

autonomousapps avatar May 01 '24 21:05 autonomousapps

While I don't have a minimal reproducer, I'm facing a similar issue which seems to be a regression in 1.28.0 onwards - I tested (successfully) 1.25.0, 1.26.0 and 1.27.0, and faced the issue with both 1.28.0, 1.29.0, 1.30.0 and 1.31.0.

Kernald avatar May 09 '24 00:05 Kernald

This duplicates https://github.com/autonomousapps/dependency-analysis-gradle-plugin/issues/1108. Closing in favor of the latter (I have a workaround posted there).

autonomousapps avatar May 23 '24 22:05 autonomousapps