8

Gradle的如下:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath "io.fabric.tools:gradle:1.+"
    }

}



repositories {
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    maven { url 'https://maven.fabric.io/public' }
}
android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        flavorDimensions "universal"
        minSdkVersion 14
        targetSdkVersion 27
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors
            {
                universal
                        {
                            versionCode 1700
                            versionName "1.7.0"
                            applicationId "ir.me.project"

                            resValue "string", "app_name", "name"
                            resValue "string", "launcher_name", "othername"
                        }
            }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'

    implementation 'com.devbrackets.android:exomedia:2.5.6'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'

    implementation 'com.squareup.okhttp3:okhttp:3.2.0'
    implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.google.firebase:firebase-messaging:10.2.1'
    implementation 'com.github.paolorotolo:appintro:4.0.0'
    implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
    implementation('com.crashlytics.sdk.android:crashlytics:2.5.7@aar')
            {
                transitive = true;
            }
}

这是我的三个项目: 在此处输入图像描述

但是得到我下面的错误:

No matching client found for package name 'ir.me.project'
4

2 回答 2

7

通过提供作为包名称google-services.json再次创建您的。applicationId根据你的 gradle 文件,你applicationIdir.me.project

于 2018-08-06T12:18:32.520 回答
1

我认为您应该为每个应用程序 ID 设置单独的 google-services.json 并使用风味创建并将它们添加到风味文件夹根文件夹中

例如,如果您有一个带有 applicationId A 的风味,那么您应该为该风味创建带有 A 包名称的 googlre-services.json

于 2018-08-06T12:18:13.500 回答