我正在将Firebase添加到一个具有3 buildTypes的现有应用程序中(调试、暂存和发布)。还有两种版本(),但我只为调试构建启用了模拟:
android.variantFilter { variant ->
if ((variant.buildType.name.equals('release') || variant.buildType.name.equals('staging'))
&& ((variant.getFlavors().get(0).name.equals('mock')))) {
variant.setIgnore(true);
}
}因此,有3种applicationIds: me.app (版本)、me.app.debug(调试)和me.app.staging (暂存)。很明显,尽管有两个变体(debugLive和debugMock),但只有一个应用程序可用于调试。
在Firebase上,我创建了一个项目,并添加了3个应用程序--每个应用程序ID都有一个。到目前为止,我还没有为这些应用程序提供SHA1密钥。我下载了google-services.json,并将其放在基本功能模块的根目录中。
我现在无法与Gradle同步项目:
More than one variant of project :myapp-base-feature matches the consumer attributes:
- Configuration ':myapp-base-feature:mockDebugApiElements' 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 'mockDebug' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required mocking 'mock' and found compatible value 'mock'.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Configuration ':myapp-base-feature:mockDebugApiElements' 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 'mockDebug' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required mocking 'mock' and found compatible value 'mock'.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Configuration ':myapp-base-feature:mockDebugApiElements' 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 'mockDebug' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required mocking 'mock' and found compatible value 'mock'.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Configuration ':myapp-base-feature:mockDebugApiElements' 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 'mockDebug' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required mocking 'mock' and found compatible value 'mock'.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Configuration ':myapp-base-feature:mockDebugApiElements' 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 'mockDebug' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required mocking 'mock' and found compatible value 'mock'.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.发布于 2018-05-09 18:47:32
将您的Google降级为3.2.1 --这是一个已知的bug,至少包含3.3.1的口味和子模块,很可能是3.3.+
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.31"
classpath 'com.google.gms:google-services:3.2.1'
classpath 'io.fabric.tools:gradle:1.25.4'
}https://stackoverflow.com/questions/50259910
复制相似问题