Firebase Crash Reporting In Android
Firebase Crash Reporting enables you to collect detailed report of errors in your app. It allows you to get the reason of particular crash/error.
We have already discussed about Firebase Remote Config and Firebase Authentication in previous articles. Today we will discuss about Firebase Crash Reporting.
Crash is one of the famous reason why user uninstalls your app from device. As android is widely used OS , it is having different dimensions, screen size, API levels, densities and some vendors also customize default OS.
So it is always difficult for a developer to find a exact problem with particular device or OS version. It might be possible that some of your code will work on your device but won’t work with other devices.
You can even log your custom events with Firebase Crash Reporting.
Firebase Crash Report gives you the device details, performance data, user data, when error occurred and what kind of error it is.
All the errors will be arranged in a groups according to error types and number of occurrences.
Firebase Crash Reporting also gives you alert on registered email address whenever new crash occur.
Firebase Crash Reporting is free to use.
Setup Firebase Crash Reporting
Step 1 : Create a new project on Firebase Console. Enter you project name and select country, than click CREATE PROJECT
Step 2 : After creation of project click on Add Firebase to your Android app. Enter package name, App nickname(optional) and SHA-1 key(optional) and click on ADD APP.
Step 3 : You will receive google-services.json file, put it inside app/ folder of your project.
Step 4 : Add dependency to your root level build.gradle file.
1 2 3 4 |
dependencies { ... classpath 'com.google.gms:google-services:3.0.0' } |
Step 5 : Add dependency to your app/module level build.gradle file.
1 2 3 4 |
dependencies { ... compile 'com.google.firebase:firebase-crash:10.2.0' } |
Step 6 : Add plugin at the bottom of your app-level build.gradle file.
1 |
apply plugin: 'com.google.gms.google-services' |
That’s it, you are done with Firebase Crash Reporting setup. Yes there is nothing else to do for developers. Neither java code nor XML code, now whenever there is any crash in device, you will see a report in Firebase Console.
It will take around 5-10 minutes to report a crash on Firebase Console.
You can even log your custom events with Firebase Crash Reporting.
1 2 3 4 5 |
try { int a = 2 / 0; } catch (Exception e) { FirebaseCrash.report(e); } |
This is how it will generate report for above Exception :
Ravi Rupareliya
Latest posts by Ravi Rupareliya (see all)
- Dialogflow Entities With Actions on Google - May 7, 2020
- Actions on Google Using Cloud Functions - February 3, 2020
- Create WhatsApp Stickers Android Application - April 19, 2019