cordova-plugin-firebase-analytics: Missing google_app_id. Firebase Analytics disabled.
When I fire a log event, I get the following error:
12-30 16:22:03.856: E/FA(17787): Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI
any idea what;s the problem?
Thanks
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 24 (5 by maintainers)
Manually entering the following tag in platforms/android/res/values/string.xml worked for me
<string name="google_app_id">1:12345:android:abc123</string>The value to enter will be the value of the mobilesdk_app_id key in google-services.jsonthanx you this is the best solution ever
@pablo-gonzalez I’m not a mantainer of this plugin/repo, I was just trying to help based on my own experience. I did try the
cordova-plugin-firebasebefore this one, so maybe that’s why I have the correct setup.This project is maintained with the free time and good will of people, so please don’t be rude implying it’s not maintained because you didn’t get a response. Maybe just nobody knows or has the same problem as you do. If you know what solves the issue, send a PR instead and you will help maintaining this.
Because of the lack of response to issues for this plugin I guess it is no longer maintained. However this fix could be useful for someone facing the same issue than me.
I realized that the google_app_di and google_api_id were missing in string.xml file.
Then I compared the code of this plugin with this one: https://github.com/arnesson/cordova-plugin-firebase
Thus to fix this issue you have to add these lines to plugin.xml before AndroidManifest.xml entry:
and add these lines to android.json before AndroidManifest.xml entry:
Doing that variables will be added to string.xml and every time you build the project they will be updated using values in GoogleService-Info.plist for ios and google-services.json for android.
@FdezRomero If you want to reproduce this issue just create a blank project with this plugin using cordova or ionic for android. Then you will realized that variables are not in string.xml after installing.
Can you bro tell me where is platforms/android/res/values/string.xml in flutter folder structure using Vs code . I am strugging this issue so many days
Solved this error on
cordova-android@6.2.3by adding this to config.xml:…which seems to stop the console throwing the missing google_app_id error.
However, I am also experiencing a different issue now:
Which suggests the libraries being used in the plugin are too old and must be updated to be used.
Ok guys, I found my solution, hope it helps. The problem is the hook, in my case (android) in the strings.xml android file there are not the google_app_id and google_api_key references. So I put my hands on the plugin very roughly and tuned it in order to take care also of this case.
The code:
if(!strings.includes('<string name="google_app_id">')) { strings = strings.replace('</resources>','\t<string name="google_app_id">' + json.client[0].client_info.mobilesdk_app_id + '</string>\n</resources>'); } if(!strings.includes('<string name="google_api_key">')){ strings = strings.replace('</resources>','\t<string name="google_api_key">' + json.client[0].api_key[0].current_key + '</string>\n</resources>'); }after the list of
strings.replaceand beforefs.writeFileSync(path.join(androidFolder, "res/values/strings.xml"), strings);on the plugins\cordova-plugin-firebase-hooks\hooks\android\copy-google-services.js file.
Please @chemerisuk give a look here and if you agree update the plugin (I’ve worked only on the android case…).