我的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'
答案 0 :(得分:3)
通过指定google-services.json
作为包名,再次创建applicationId
。
根据您的gradle文件,您的applicationId
是 ir.me.project
答案 1 :(得分:1)
我认为您应该为每个要使用Flavor创建的应用程序ID分别设置google-services.json并将其添加到flavor文件夹根文件夹中
例如,如果您的applicationId A有一种口味,则您应使用该口味的包名称A创建googlre-services.json