10 Replies Latest reply on May 7, 2017 10:07 AM by canados

    Firebase initialization unsuccessful / cordova 6.5.0 / phonegap build

    canados Level 1

      Hello Phonegap Build


      I am trying to connect firebase analytics in my project

      When I check the log of DDMS or monitor I have this message



      03-27 13:29:33.495: I/FirebaseInitProvider(21341): FirebaseApp initialization unsuccessful

      03-27 13:29:33.675: D/FirebaseAnalyticsPlugin(21341): Starting Firebase Analytics plugin

      03-27 13:29:33.685: I/FA(21341): adb shell setprop debug.firebase.analytics.app com.myapp.app

      03-27 13:29:33.695: E/FA(21341): Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI

      I am using cordova 6.5.0 and phonegap build / currently testing on android
      I added both google-services.json and GoogleService-Info.plist to the root of www folder.

      With phonegap, I only have access to the config.xml, what info do I need to add in config.xml ?


      I also have in my config.xml

      <gap:plugin name="cordova-plugin-play-games-services" source="npm" />

      <gap:plugin name="cordova-plugin-firebase-analytic" source="npm" />

      <gap:plugin name="cordova-plugin-firebase-hooks" source="npm" />


      But I still have FirebaseApp initialization unsuccessful
      After searching around on the web, it seems that I have to edit the file res/values/strings.xml
      Here are all the possibilities that I tried in the config.xml in order to do so ( config xml with widget xmlns:android="http://schemas.android.com/apk/res/android" )


      <edit-config file="res/values/strings.xml" mode="merge" target="/*">

              <string name="google_app_id">1:XXXXXXXXXX:android:XXXXXXXXXX</string>

              <string name="google_api_key">XXXXXXXXXX-XXXXXXXXXX</string>



          <gap:config-file parent="/resources" target="res/values/strings.xml">

              <string name="google_app_id">1:XXXXXXXXXX:android:XXXXXXXXXX</string>

              <string name="google_api_key">XXXXXXXXXX-XXXXXXXXXX</string>



          <config-file target="res/values/strings.xml" parent="/resources" mode="replace">

              <string name="google_app_id">1:XXXXXXXXXX:android:XXXXXXXXXX</string>

              <string name="google_api_key">XXXXXXXXXX-XXXXXXXXXX</string>



      So questions ...
      - Am I the only one struggling to plug firebase-analytics in phonegap build?
      - Does anyone successfully installed firebase-analytics in phonegap build?
      - Does anyone knows a way to manually change / edit the res/values/string.xml from the config.xml ?