GoogleService未能初始化,状态:10,名称为google_app_id的字符串资源中缺少google app id值

sn0*_*0ep 3 android firebase google-play-services firebase-cloud-messaging

我把这个错误弄得一团糟,它过去工作正常。这是我所拥有的:

在app.gradle依赖项中:

implementation "com.google.firebase:firebase-core:16.0.1"
implementation "com.google.firebase:firebase-messaging:17.3.1"
Run Code Online (Sandbox Code Playgroud)

在app.gradle文件末尾:

apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

在项目gradle文件中:

 dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-alpha10'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'io.fabric.tools:gradle:1.+'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.1.0'
    }
Run Code Online (Sandbox Code Playgroud)

google-services.json位于我项目的每个文件夹中,只是看它是否正常工作。

但仍然出现上述错误。

小智 6

更新到Android Studio 3.3之后,我开始遇到相同的错误。原来版本4.1.0com.google.gms:google-servicesAndroid Studio 3.3 中存在一个已知问题。

正在com.google.gms:google-services:4.2.0为我解决问题。