web-dev-qa-db-fra.com

Erreur Gradle: plusieurs variantes de projet: myModule correspond aux attributs des consommateurs après la mise à niveau vers de nouveaux services Google

Edit : Semble être un bug du côté de Google. Rapport de bogue ici: https://issuetracker.google.com/issues/7923524


Depuis que Google a publié les nouvelles modifications (), j'ai dû mettre à jour les services google. Une fois que j'ai fait, j'obtiens cette erreur 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'.

Voici le build.gradle du projet:

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" }
  }
}
24
Sree

J'ai eu exactement le même problème et j'ai trouvé la réponse à changer la syntaxe de la référence du module incriminé comme suit:

Implémentation précédente:

projet de compilation (': myModule')

Implémentation actuelle:

projet de compilation (chemin: ': linkedin-sdk', configuration: 'default')

merci...

Merci à https://github.com/dialogflow/dialogflow-Android-client/issues/57

11
user3621075

Je n'ai pas mis à jour les services, mais j'ai eu le même problème. J'ai passé 5 heures à chercher une solution. Fixé uniquement de cette façon.

Essayez de définir

classpath 'com.google.gms:google-services:3.2.1'

au lieu de

classpath 'com.google.gms:google-services:3.3.0'

Cela m'a aidé dans mon cas, mais je ne connais pas la cause de l'erreur.

5
Zeon