Add Android app to Firebase Crashlytics

On How to Add Android app to Firebase Crashlytics. You have to follow the below steps. First you need to understand the importance of Crashlytics. Suppose you have a large number of active users who are using you’r application so if any error occurs you need the source of that error and debug accordingly both in development and production. So Don’t worry sit tight Firebase is there for you for debugging.

What is Firebase Crashlytics?

Firebase Crashlytics is a lightweight, realtime crash reporter that helps you track, prioritize, and fix stability issues that erode your app quality. Crashlytics saves you troubleshooting time by intelligently grouping crashes and highlighting the circumstances that lead up to them.

Add Android app to Firebase Crashlytics

  1. If not done in previous app you can go through this Connect your Android app to Firebase Console.
  2. Click on Crashlytics under Quality in Firebase console.
  3. Click this app is new to Crashlytics .

Add Crashlytics SDK

  1. In your project bild.gradle add
buildscript {
    repositories {

        // Add Google's Maven repository.
        google()

        maven {
           url 'https://maven.fabric.io/public'
        }

    }

    dependencies {
        // ...

        // Add the Google Services plugin (check for v3.1.2 or higher).
        classpath 'com.google.gms:google-services:4.3.3'

        // Add the Fabric Crashlytics plugin.
        classpath 'io.fabric.tools:gradle:1.31.2'


    }
}


allprojects {
    // ...

    repositories {

       // Check that Google's Maven repository is included (if not, add it).
       google()


       // ...
    }
}




2. Add your app level build.gradle.

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
// Add the Fabric plugin.
apply plugin: 'io.fabric'


dependencies {
    // ...

    // (Recommended) Add the Google Analytics dependency.
    implementation 'com.google.firebase:firebase-analytics:17.2.3'

    // Add the Firebase Crashlytics dependency.
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'

}

3. Change min Sdk version to 16 in app level build.gradle.

Add an error to report

add this code in MainActiviety.

int[] error = new int[-1];// add an error to listen

Github

You can get the repository from here.

Tagged : / / / / / / /