com.google.gson.stream.MalformedJsonException:第 11 行第 10 列路径 $.client[0].client_info 应为“:”

com.google.gson.stream.MalformedJsonException: Expected ':' at line 11 column 10 path $.client[0].client_info

所以我添加了 FCM 并且它可以工作,但是如果我想 运行 命令 flutter buil apk --release 我得到了愚蠢的错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseGoogleServices'.
> com.google.gson.stream.MalformedJsonException: Expected ':' at line 11 column 10 path $.client[0].client_info.<<<<<<<

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 11s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                      12.1s
Gradle task assembleRelease failed with exit code 1

我找到了这个 但如果我删除带有 apply plugin: 'com.google.gms.google-services' 的行,推送通知将不再有效

问题出在您的 google-services.json 文件中。您是否偶然手动编辑了它?您可以尝试从 Firebase 再次下载该文件或尝试查找丢失的“:”。它应该靠近文件的顶部(第 10-11 行)。找到“客户端”键,然后是第一个“client_info”键。

检查你的 google-services.json 文件是否有问题。