我正在将Firebase添加到具有3个buildTypes(调试,登台和发布)的现有应用程序中。还有2种口味(实时和模拟),但我只为调试版本启用了模拟:
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(debug)和me.app.staging(staging)。很明显,虽然有2个变种(debugLive和debugMock),但是只有一个用于调试的应用程序
在Firebase上,我创建了1个项目并添加了3个应用程序 - 每个应用程序ID为1个。到目前为止,我没有为这些应用程序提供SHA1密钥。我下载了google-services.json并将其放在base-feature模块的根目录中。
我现在无法与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'.
答案 0 :(得分:3)
将您的Google服务降级为3.2.1 它至少是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'
}