Iva*_*nev 5 android firebase firebase-cloud-messaging android-app-bundle
A 有一个包含大量依赖项的大项目,包括 Firebase。
现在com.google.firebase:firebase-messaging版本为17.3.3。我想将其更新为20.2.1。
应用程序启动后出现下一个错误:
Firebase-Installations: Error when communicating with the Firebase Installations server API. HTTP response: [403 Forbidden: {
"error": {
"code": 403,
"message": "Requests from this Android client application com.example are blocked.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developer console API key",
"url": "https://console.developers.google.com/project/61947752567/apiui/credential"
}
]
}
]
}
}
]
Firebase Installations can not communicate with Firebase server APIs due to invalid configuration. Please update your Firebase initialization process and set valid Firebase options (API key, Project ID, Application ID) when initializing Firebase.
Run Code Online (Sandbox Code Playgroud)
我们使用 google-services.json 在我们的应用程序中配置 FCM。我们不在代码中使用 FirebaseOptions。
我注意到问题与将 FCM 更新到20.1.1 相关。谷歌对 FCM 20.1.1 的评价:
Firebase 云消息传递和 Firebase 实例 ID SDK 现在可传递地依赖于 Firebase 安装 SDK。如果您使用 Cloud Messaging 并将依赖项更新到最新版本,请确保推送通知仍按预期工作。
我阅读了 Google 的说明,但没有成功。我试过的:
事实证明,从 APK 应用程序安装的应用程序可以正常工作!如果我使用 .aab (App Bundle) - 我会收到这个错误。我也使用最新的 bundletool。
firebase-messaging 包含在我们的主要应用程序模块中,它是应用程序的主要功能之一。我不是在谈论动态模块 - 问题在于主模块。
我无法再次设置 FCM,因为现在有很多用户在使用此应用程序。此外,我不明白为什么我必须设置有效选项(API 密钥、项目 ID、应用程序 ID),如果此选项在过去几年中运行良好并且 google-services.json 没有更改。
我将不胜感激任何想法。
PS 我不能使用 FCM 20.1.0,因为我需要集成 ML Kit 依赖项。它仅适用于 FCM 的实际版本,并在 FCM 20.1.0 时崩溃
有时,项目需要简单的重建/清理,因为预编译的过时文件 (json/xml) 保留在项目的预编译版本中。
在 Android IDE 中运行:Build -> "Clean Project"和"Build" -> "Rebuild Project"。
这并非在所有情况下都有帮助。重新下载google-services.json文件可能比手动编辑/检查文件更好。替换文件后不要忘记重建/清理。
| 归档时间: |
|
| 查看次数: |
1805 次 |
| 最近记录: |