修改:似乎是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'.
这是Project的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" }
}
}
答案 0 :(得分:11)
我有完全相同的问题,并找到答案是更改违规模块参考的语法,如下所示:
以前的实施:
编译项目(':myModule')
当前实施:
编译项目(路径:':linkedin-sdk',配置:'默认')
感谢...
感谢https://github.com/dialogflow/dialogflow-android-client/issues/57
答案 1 :(得分:5)
我没有更新服务,但我遇到了同样的问题。我花了5个小时寻找解决方案。仅固定这种方式。
尝试设置
classpath 'com.google.gms:google-services:3.2.1'
而不是
classpath 'com.google.gms:google-services:3.3.0'
在我的案例中它有所帮助,但我不知道错误的原因。