Cordova 应用程序中的 cordova-plugin-firebase-analytics 插件在 Android 上出现无效 google_app_id 错误
Invalid google_app_id error on Android with cordova-plugin-firebase-analytics plugin in Cordova app
我已经设置了一个 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 文件(在 platforms/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 文件来修复它,如下所示:
<string name="google_app_id">x:xxxxxxxxxxxx:android:xxxxxxxxxxxxx</string>.
希望对你有所帮助
我已经设置了一个 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 文件(在 platforms/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 文件来修复它,如下所示:
<string name="google_app_id">x:xxxxxxxxxxxx:android:xxxxxxxxxxxxx</string>.
希望对你有所帮助