jjzjj

android - Gradle 错误 : More than one variant of project :myModule matches the consumer attributes after upgrading to new Google Services

coder 2023-06-07 原文

编辑:似乎是 Google 方面的错误。错误报告:https://issuetracker.google.com/issues/79235243


自从谷歌发布了新的变化(),我不得不更新谷歌服务。一旦我这样做了,我就会得到这个 gradle 错误:

More than one variant of project :myModule matches the consumer attributes:
  - Configuration ':myModule:debugApiElements' variant android-aidl:
      - Found artifactType 'android-aidl' but wasn't required.
      - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
      - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
      - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
      - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
  - Configuration ':myModule:debugApiElements' variant android-classes:
      - Found artifactType 'android-classes' but wasn't required.
      - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
      - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
      - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
      - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
  - Configuration ':myModule:debugApiElements' variant android-manifest:
      - Found artifactType 'android-manifest' but wasn't required.
      - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
      - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
      - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
      - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
  - Configuration ':myModule:debugApiElements' variant android-renderscript:
      - Found artifactType 'android-renderscript' but wasn't required.
      - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
      - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
      - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
      - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
  - Configuration ':myModule:debugApiElements' variant jar:
      - Found artifactType 'jar' but wasn't required.
      - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
      - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
      - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
      - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.

这是项目的 build.gradle:

buildscript {
  repositories {
    google()
    jcenter()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
    classpath 'com.google.gms:google-services:3.3.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }
}

allprojects {
  repositories {
    google()
    jcenter()
    maven{
      url 'https://oss.sonatype.org/content/repositories/snapshots/'
    }
    maven {
      url "https://maven.google.com"
    }
    maven { url "https://jitpack.io" }
  }
}

最佳答案

我遇到了完全相同的问题,发现答案是更改有问题的模块引用的语法如下:

以前的实现:

compile project(':myModule')

当前实现:

compile project(path: ':linkedin-sdk', configuration: 'default')

谢谢...

感谢 https://github.com/dialogflow/dialogflow-android-client/issues/57

关于android - Gradle 错误 : More than one variant of project :myModule matches the consumer attributes after upgrading to new Google Services,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50166596/

有关android - Gradle 错误 : More than one variant of project :myModule matches the consumer attributes after upgrading to new Google Services的更多相关文章

随机推荐