Want to add  Firebase Crashlytics to your ionic project using Cordova

Want to add Firebase Crashlytics to your ionic project using Cordova

·

2 min read

Hello Everyone! I spent more time to did it🥴. how to integrate firebase crashlytics with the ionic project in vue or angular. A Google Firebase Crashlytics plugin to enable capture of crash reports.

  1. first we need to install Cordova in your project
npm i -g cordova
  1. Install cordova-plugin-firebase-crashlytics
ionic cordova plugin add cordova-plugin-firebase-crashlytics 
npm install @awesome-cordova-plugins/firebase-crashlytics

3.next we go to create new firebase account

first step to Add Project then put name

Screenshot from 2022-08-09 10-42-59.png

second step to go create a project here if you want to google analytics to if you don't want GA just click toggle it's disabled and click to continue

Screenshot from 2022-08-09 10-43-11.png

now we are created the project successfully.

Screenshot from 2022-08-09 10-43-31.png

next we had a project overview dashboard in there left hand side we have been Release & Monitoring click and go firebase crashlytics dashboard page view like this

Screenshot from 2022-08-09 10-43-50.png

The next thing to do go to add firebase to your android app

Screenshot from 2022-08-09 10-43-37.png

register your app note: put your app id like this: com.test.firebase

Screenshot from 2022-08-09 10-44-07.png

Download config file to your local storage

Screenshot from 2022-08-09 10-44-32.png

note: if you should check your project inside google-service.json file exist or not exist if not exist find and put file .it's automatically generate to your platform inside android. if not generated go to put manually. then only you can integrate firebase crashlytics. I to stuck this step I did not add so its firebase crashlytics didn't work so need to check if it's there or not . Screenshot from 2022-08-09 10-44-42.png

Screenshot from 2022-08-09 10-44-47.png

Adding required configuration files in your config.xml file

Cordova supports a resource-file tag for easy copying of resource files. Firebase SDK requires google-services.json on Android platforms.

Put google-services.json and into the root directory of your Cordova project Add new tag for the Android platform

<platform name="android">
    ...
    **<resource-file src="google-services.json" target="app/google-services.json" />**
</platform>
...
<platform name="ios">
    ...
    <resource-file src="GoogleService-Info.plist" />
</platform>

This way config files will be copied on the Cordova prepare step.

then go to your project put some logging in firebase crashlytics

for example test

firebaseCrashlytics.crash();

above line go to crash your app then go to check your dashboard what are the events failed status view dashboard page .here we can see elaborate detail about the crash.

finally, we will see below the dashboard firebase-crashlytics.png

if you have any doubt regarding this put your comment in comment section

I hope it will helpful for someone🙂🙂

Did you find this article valuable?

Support ramu k by becoming a sponsor. Any amount is appreciated!

Â