android-crash-reporting-icoderslab

Android Crash Reporting Tutorial Using Google Firebase

create-project-firebase-icoderslab
If you are not going to use google alpha/beta testing then you will surely face issues in getting error logs from client. There are many android devices with different android api in market and testing your app on each device is really a tough job. Using Firebase Crash Reporting you can get all crash logs with required details to fix errors, in this tutorial we will discuss how to use Google Firebase for android crash reporting.

Open Firebase Console

Create New project, Now click on add firebase to android

Enter your project package name and optional signing certificate.

addpackagename-firebase-icoderslab

It will create google-services.json file Move it into your Android app module root directory.

googleservice-json-icoderslab

Add following code:

In Project-level build.gradle (<project>/build.gradle):

buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:3.0.0'
}
}

In App-level build.gradle (<project>/<app-module>/build.gradle):

// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'

Add following in In App-level build.gradle

compile 'com.google.firebase:firebase-crash:9.0.0'

Now sync your project

firebase-gradle

Now throw exception to record it on firebase interface.

Use following code in your activity to throw exception:

FirebaseCrash.report(new Exception("iCodersLab.com : My first Android non-fatal error"));

Firebase Console:

Here is my first error that logged on Firebase console.

firebase-console-crash-report-interface-icoderslab

On Error click you can see it’s details, like android api, device name etc

firebase-console-crash-report-interface-icoderslab1

Download Code

Leave a Reply

Your email address will not be published. Required fields are marked *