找不到与包名称 processAppDebugGoogleServices 匹配的客户端

Kil*_*ler 5 android google-play-services android-productflavors

我已经尝试了 Stack Overflow 上几乎所有相关的解决方案。但问题仍然没有解决。

Error: Execution failed for task ':App:processAppDebugGoogleServices'.
> No matching client found for package name 'com.example.application'
Run Code Online (Sandbox Code Playgroud)

设置.gradle:

include ':App'
Run Code Online (Sandbox Code Playgroud)

这是清单代码:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.application"
    android:versionCode="17"
    android:versionName="1.17">
Run Code Online (Sandbox Code Playgroud)

以下是应用程序级别的 Gradle 依赖项:

classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha3'
Run Code Online (Sandbox Code Playgroud)

问题:flavor1,即应用程序,正在生成错误,而 application_rtl 工作正常。

alb*_*aun 5

如果应用程序使用 Google 服务但未为应用程序的 applicationId (packageName) 正确配置“google-services.json”文件,则会生成“找不到匹配的客户端...”消息。

验证您的项目是否有一个“google-services.json”文件,其中包含一个“android_client_info”块,“package_name”为“com.example.application”。

寻找一个看起来像这样的块:

"client_info": {
     "mobilesdk_app_id":"1:12345678901:android:876a5bc432109d87”, 
     "android_client_info": {
          "package_name": "com.example.application”
     }
}
Run Code Online (Sandbox Code Playgroud)

并验证它是否正确。可能最好的办法就是从 Firebase 控制台生成一个新的、正确的 google-services.json 文件。

请参阅:https : //firebase.google.com/docs/android/setup