【问题标题】:Invalid google_app_id error on Android with cordova-plugin-firebase-analytics plugin in Cordova app使用 Cordova 应用程序中的 cordova-plugin-firebase-analytics 插件在 Android 上出现无效的 google_app_id 错误
【发布时间】:2018-01-04 21:28:14
【问题描述】:

我已经设置了一个 Cordova 应用程序来使用 cordova-plugin-firebase-analytics 插件(它使用了 cordova-support-google-services 插件)。它适用于 iOS,但不适用于 Android。在 Android 上,这些事件永远不会被注册。当我使用“adb logcat”输出日志时,出现以下错误:

01-02 13:54:57.322 E/FA (18325): Invalid google_app_id. Firebase Analytics disabled. See https_/goo.gl/NAOOOI. provided id: 1046165292000

注意:我修改了日志中的 url,因此 Stack Overflow 不会抱怨 url 缩短器。

我已从 Firebase 控制台添加了 google-services.json 文件,并将 com.google.gms 插件行添加到了我的 build.gradle 文件(在平台/android 中)。老实说,我不知道接下来要看什么,有什么想法吗?

这是 google-services.json 文件(已修改识别数据)

{
    "project_info": {
        "project_number": "1000000000000",
        "firebase_url": "https://my-app.firebaseio.com",
        "project_id": "my-app",
        "storage_bucket": "my-app.appspot.com"
    },
    "client": [
        {
            "client_info": {
                "mobilesdk_app_id": "1:1000000000000:android:5da9694e695bed4d",
                "android_client_info": {
                    "package_name": "ca.my.app"
                }
            },
            "oauth_client": [
                {
                    "client_id": "1000000000000-f1l9aikqj3q9fb5bmosdor3acghq60av.apps.googleusercontent.com",
                    "client_type": 3
                }
            ],
            "api_key": [
                {
                    "current_key": "__mykey__"
                }
            ],
            "services": {
                "analytics_service": {
                    "status": 1
                },
                "appinvite_service": {
                    "status": 1,
                    "other_platform_oauth_client": []
                },
                "ads_service": {
                    "status": 2
                }
            }
        }
    ],
    "configuration_version": "1"
}

谢谢, 杰森

【问题讨论】:

  • 我也面临同样的问题。你修好了吗?
  • 我通过将应用程序 ID 从 Firebase 控制台 (x:xxxxxxxxxxxx:android:xxxxxxxxxxxxx) 复制到 string.xml 文件来修复它: x:xxxxxxxxxxxx:android: xxxxxxxxxxxxx。希望对您有所帮助。
  • @Rocker23 我现在可以使用它,但我记得尝试了很多不同的东西。我隐约记得这是与旧版本的 phonegap-plugin-push 插件冲突的问题。您的解决方案与推送插件 Github 上的建议相匹配,所以继续添加它作为答案,我会选择它。
  • 是的,旧版本的插件也有同样的问题。谢谢

标签: android cordova google-analytics firebase-analytics


【解决方案1】:

我通过将应用程序 ID 从 Firebase 控制台 (x:xxxxxxxxxxxx:android:xxxxxxxxxxxxx) 复制到 string.xml 文件来修复它:

<string name="google_app_id">x:xxxxxxxxxxxx:android:xxxxxxxxxxxxx</string>.

希望对你有帮助

【讨论】:

  • 传奇!看了一整天!
猜你喜欢
  • 1970-01-01
  • 2019-04-04
  • 1970-01-01
  • 1970-01-01
  • 2022-12-14
  • 1970-01-01
  • 1970-01-01
  • 2015-09-28
  • 1970-01-01
相关资源
最近更新 更多