spotbugs / spotbugs-gradle-plugin

https://plugins.gradle.org/plugin/com.github.spotbugs
Apache License 2.0
180 stars 68 forks source link

Failed at Android project: Cannot choose between the following variants of project #375

Closed YunanChen closed 4 years ago

YunanChen commented 4 years ago

I use the spotbugs-gradle-plugin:4.5.1 at Android project, which contains app module, effect module, player module and so on. When running ./gradlew spotbugsMain, I get following error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:spotbugsMain'.
> Could not resolve all task dependencies for configuration ':app:compileClasspath'.
   > Could not resolve project :effect.
     Required by:
         project :app
      > Cannot choose between the following variants of project :effect:
          - debugApiElements
          - releaseApiElements
        All of them match the consumer attributes:
          - Variant 'debugApiElements' capability android_radio_proj:effect:unspecified:
              - Unmatched attributes:
                  - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
                  - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
              - Compatible attribute:
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
          - Variant 'releaseApiElements' capability android_radio_proj:effect:unspecified:
              - Unmatched attributes:
                  - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
                  - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
              - Compatible attribute:
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
   > Could not resolve project :player.
     Required by:
         project :app
      > Cannot choose between the following variants of project :player:
          - debugAndroidTestCompile
          - debugAndroidTestRuntime
          - debugApiElements
          - debugRuntime
          - debugRuntimeElements
          - debugUnitTestCompile
          - debugUnitTestRuntime
          - releaseApiElements
          - releaseRuntime
          - releaseRuntimeElements
          - releaseUnitTestCompile
          - releaseUnitTestRuntime
        All of them match the consumer attributes:
          - Variant 'debugAndroidTestCompile' capability android_radio_proj:player:unspecified:
              - Unmatched attributes:
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Required org.gradle.usage 'java-api' but no value provided.
                  - Found org.jetbrains.kotlin.localToProject 'local to :player' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
          - Variant 'debugAndroidTestRuntime' capability android_radio_proj:player:unspecified:
              - Unmatched attributes:
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Required org.gradle.usage 'java-api' but no value provided.
                  - Found org.jetbrains.kotlin.localToProject 'local to :player' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
          - Variant 'debugApiElements' capability android_radio_proj:player:unspecified:
              - Unmatched attributes:
                  - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
                  - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
              - Compatible attribute:
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
          - Variant 'debugRuntime' capability android_radio_proj:player:unspecified:
              - Unmatched attributes:
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Required org.gradle.usage 'java-api' but no value provided.
                  - Found org.jetbrains.kotlin.localToProject 'local to :player' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
          - Variant 'debugRuntimeElements' capability android_radio_proj:player:unspecified:
              - Unmatched attributes:
                  - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
                  - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
              - Compatible attribute:
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-runtime'.
          - Variant 'debugUnitTestCompile' capability android_radio_proj:player:unspecified:
              - Unmatched attributes:
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Required org.gradle.usage 'java-api' but no value provided.
                  - Found org.jetbrains.kotlin.localToProject 'local to :player' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
          - Variant 'debugUnitTestRuntime' capability android_radio_proj:player:unspecified:
              - Unmatched attributes:
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Required org.gradle.usage 'java-api' but no value provided.
                  - Found org.jetbrains.kotlin.localToProject 'local to :player' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
          - Variant 'releaseApiElements' capability android_radio_proj:player:unspecified:
              - Unmatched attributes:
                  - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
                  - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
              - Compatible attribute:
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
          - Variant 'releaseRuntime' capability android_radio_proj:player:unspecified:
              - Unmatched attributes:
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Required org.gradle.usage 'java-api' but no value provided.
                  - Found org.jetbrains.kotlin.localToProject 'local to :player' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
          - Variant 'releaseRuntimeElements' capability android_radio_proj:player:unspecified:
              - Unmatched attributes:
                  - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
                  - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
              - Compatible attribute:
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-runtime'.
          - Variant 'releaseUnitTestCompile' capability android_radio_proj:player:unspecified:
              - Unmatched attributes:
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Required org.gradle.usage 'java-api' but no value provided.
                  - Found org.jetbrains.kotlin.localToProject 'local to :player' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
          - Variant 'releaseUnitTestRuntime' capability android_radio_proj:player:unspecified:
              - Unmatched attributes:
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Required org.gradle.usage 'java-api' but no value provided.
                  - Found org.jetbrains.kotlin.localToProject 'local to :player' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
   > Could not resolve project :controller.
     Required by:
         project :app
      > Cannot choose between the following variants of project :controller:
          - debugApiElements
          - releaseApiElements
        All of them match the consumer attributes:
          - Variant 'debugApiElements' capability android_radio_proj:controller:unspecified:
              - Unmatched attributes:
                  - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
                  - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
              - Compatible attribute:
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
          - Variant 'releaseApiElements' capability android_radio_proj:controller:unspecified:
              - Unmatched attributes:
                  - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
                  - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
                  - Required org.gradle.category 'library' but no value provided.
                  - Required org.gradle.dependency.bundling 'external' but no value provided.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
              - Compatible attribute:
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
   > Could not resolve androidx.appcompat:appcompat:1.2.0.
     Required by:
         project :app > com.tencent.galactica.android:AppTemplate:0.9.4.29-SNAPSHOT
      > Unable to find a matching variant of androidx.appcompat:appcompat:1.2.0:
          - Variant 'releaseApiPublication' capability androidx.appcompat:appcompat:1.2.0:
              - Incompatible attribute:
                  - Required org.gradle.libraryelements 'classes' and found incompatible value 'aar'.
              - Other attributes:
                  - Required org.gradle.category 'library' and found compatible value 'library'.
                  - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
          - Variant 'releaseRuntimePublication' capability androidx.appcompat:appcompat:1.2.0:
              - Incompatible attribute:
                  - Required org.gradle.libraryelements 'classes' and found incompatible value 'aar'.
              - Other attributes:
                  - Required org.gradle.category 'library' and found compatible value 'library'.
                  - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-runtime'.
          - Variant 'sourcesElements' capability androidx.appcompat:appcompat:1.2.0:
              - Incompatible attribute:
                  - Required org.gradle.category 'library' and found incompatible value 'documentation'.
              - Other attributes:
                  - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
                  - Found org.gradle.docstype 'sources' but wasn't required.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-runtime'.
   > Could not resolve androidx.appcompat:appcompat:1.0.0.
     Required by:
         project :app > com.tencent.qapm:qapmsdk:4.0.0.15
      > Unable to find a matching variant of androidx.appcompat:appcompat:1.2.0:
          - Variant 'releaseApiPublication' capability androidx.appcompat:appcompat:1.2.0:
              - Incompatible attribute:
                  - Required org.gradle.libraryelements 'classes' and found incompatible value 'aar'.
              - Other attributes:
                  - Required org.gradle.category 'library' and found compatible value 'library'.
                  - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
          - Variant 'releaseRuntimePublication' capability androidx.appcompat:appcompat:1.2.0:
              - Incompatible attribute:
                  - Required org.gradle.libraryelements 'classes' and found incompatible value 'aar'.
              - Other attributes:
                  - Required org.gradle.category 'library' and found compatible value 'library'.
                  - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-runtime'.
          - Variant 'sourcesElements' capability androidx.appcompat:appcompat:1.2.0:
              - Incompatible attribute:
                  - Required org.gradle.category 'library' and found incompatible value 'documentation'.
              - Other attributes:
                  - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
                  - Found org.gradle.docstype 'sources' but wasn't required.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-runtime'.
   > Could not resolve androidx.appcompat:appcompat:1.1.0.
     Required by:
         project :app > com.tencent.kingcard:common:5.3.3.5331
      > Unable to find a matching variant of androidx.appcompat:appcompat:1.2.0:
          - Variant 'releaseApiPublication' capability androidx.appcompat:appcompat:1.2.0:
              - Incompatible attribute:
                  - Required org.gradle.libraryelements 'classes' and found incompatible value 'aar'.
              - Other attributes:
                  - Required org.gradle.category 'library' and found compatible value 'library'.
                  - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
          - Variant 'releaseRuntimePublication' capability androidx.appcompat:appcompat:1.2.0:
              - Incompatible attribute:
                  - Required org.gradle.libraryelements 'classes' and found incompatible value 'aar'.
              - Other attributes:
                  - Required org.gradle.category 'library' and found compatible value 'library'.
                  - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-runtime'.
          - Variant 'sourcesElements' capability androidx.appcompat:appcompat:1.2.0:
              - Incompatible attribute:
                  - Required org.gradle.category 'library' and found incompatible value 'documentation'.
              - Other attributes:
                  - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
                  - Found org.gradle.docstype 'sources' but wasn't required.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'classes' but no value provided.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'java-api' and found compatible value 'java-runtime'.
YunanChen commented 4 years ago

It is succeed when running the spotbugsDebug task