【发布时间】:2017-02-04 16:04:09
【问题描述】:
昨天,我将我的 google services gradle 插件更新为:
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
}
在那之后,我的 devDebug 风味构建中出现以下错误:
Error:org.gradle.api.GradleException: No matching client found for package name 'com.example.android.dev'
这是我的应用级别build.gradle文件的相关部分:
defaultConfig {
applicationId 'com.example.android'
multiDexEnabled true
minSdkVersion 16
targetSdkVersion 24
versionCode 47
versionName "1.3.2"
signingConfig signingConfigs.myConfig
renderscriptTargetApi 24
renderscriptSupportModeEnabled true
}
buildTypes {
debug {
applicationIdSuffix = ".dev"
resValue "string", "app_name", "example-debug"
}
release {
minifyEnabled false
shrinkResources false
resValue "string", "app_name", "example"
signingConfig signingConfigs.myConfig
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
dev {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the application.
minSdkVersion 16
}
}
此错误不会出现在我的 prodRelease 产品风味版本中。我该如何解决?
【问题讨论】:
-
您的调试版本与生产版本的应用程序 ID 不同。在 Firebase 控制台中添加具有该应用 ID 的 Android 应用并获取新的配置 JSON。
-
@EugenPechanec 如果我使用调试构建应用程序 ID 注册,它是否适用于所有构建类型和风格?
-
google-services.json 将包含下载时来自控制台的所有信息,所以是的。
-
@EugenPechanec 澄清一下,现在我的应用程序使用包名
com.example.android注册,我的调试版本使用包名com.example.android.dev。所以我应该在 Firebase 控制台中使用调试构建包名称注册我的应用程序,对吧?
标签: android firebase build.gradle android-productflavors android-build-type