1

I am attempting to create and Android Library project with the latest Android Gradle plugin and am having a hard time understanding the error it is giving me. My setup is a java module, android library module and a second android library module. They are all within the same project.

  • Module A (built with java (not java-library) plugin)
  • Module B (built with android library plugin)
  • Module C (build with android library plugin)

  • Module B depends on Module A

  • Module C depends on both Module A and Module B

Module C's dependency block:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation project(':moduleA')
    implementation project(':moduleB')
}

Gradle syncs fine and assemble executes correctly. I am using Gradle 4.6 (have tried with 4.4 as well) and Android Gradle Plugin 3.1.2. The problem occurs both in Android Studio and on Jenkins. When trying to run uploadArchives I receive the following error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':moduleC:uploadArchives'.
> Could not publish configuration 'archives'
   > Could not resolve all files for configuration ':moduleC:archives'.
      > Could not resolve project :moduleB.
        Required by:
            project :moduleC
         > Cannot choose between the following configurations of project :moduleB:
             - debugApiElements
             - debugRuntimeElements
             - releaseApiElements
             - releaseRuntimeElements
           All of them match the consumer attributes:
             - Configuration 'debugApiElements':
                 - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
                 - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
                 - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
                 - Found org.gradle.usage 'java-api' but wasn't required.
             - Configuration 'debugRuntimeElements':
                 - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
                 - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
                 - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
                 - Found org.gradle.usage 'java-runtime' but wasn't required.
             - Configuration 'releaseApiElements':
                 - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
                 - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
                 - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
                 - Found org.gradle.usage 'java-api' but wasn't required.
             - Configuration 'releaseRuntimeElements':
                 - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
                 - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
                 - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
                 - Found org.gradle.usage 'java-runtime' but wasn't required.
Jared
  • 1,449
  • 2
  • 19
  • 40

0 Answers0