Crash monitoring tools help developers build, deploy, and maintain high-quality apps. These tools can alert you to new issues in real-time. The quicker you learn about new issues, the sooner you can get a fix to your users. There is also an opportunity to proactively reach out to users impacted by ongoing issues. All developers should implement some form of crash reporting to monitor the health of their apps.
This article will guide you through quickly setting up crash monitoring with Crashlytics in your current Android app.
There are many alternative tools you can use for crash monitoring, but Crashlytics–a Fabric service owned by Google–is one of the most popular and widely used. Crashlytics’ integration is easy–even for novice developers. It is completely free. The reporting is customizable and detailed. There’s good documentation and support.
While other crash reporting tools may be more suitable for your needs, it’s important note that some tools like Firebase require Google Play services, which some AOSP-based OS’s do not have (e.g., Clover and Amazon Fire).
These instructions are based on the Crashlytic’s installation guide.
2. Apply the Fabric plugin:
Add your API key to the AndroidManifest.xml file:
In the MainActivity.java file, import the following:
(Optional) To log user information that will be displayed on crash reports, you will need to add one or any combination of the following in your app (see sample):
The Crashlytics Dashboard lets you monitor the health of your app in real-time. It shows you details like number of crashes, percentage of crash-free users, and which users are impacted by each crash; so you are able to identify and prioritize bug fixes.
If you log user information with Crashlytics, you can identify specific users impacted by certain crashes. You can provide proactive outreach acknowledging active issues and sharing possible workarounds.
_________________________________________________________________________________
This article will guide you through quickly setting up crash monitoring with Crashlytics in your current Android app.
While other crash reporting tools may be more suitable for your needs, it’s important note that some tools like Firebase require Google Play services, which some AOSP-based OS’s do not have (e.g., Clover and Amazon Fire).
These instructions are based on the Crashlytic’s installation guide.
Signing up for Fabric and getting your API key
Before starting to integrate, you’ll need to sign up for a free Fabric account. After you confirm your email, you will be redirected to an onboarding page that will ask you, “What platform are you building for?” You can ignore this onboarding page.
If you have a new account, you will be unable to access your Dashboard to get your API key. You’ll be redirected to the onboarding page. However, on Crashlytic’s installation guide, while logged in you can find your API key in the “Add Your API Key” section.
Install with Gradle
The installation is pretty simple. You will need to add the following code snippets below to these project files: build.gradle, AndroidManifest.xml, and MainActivity.java.
build.gradle
In your build.gradle app module, you will need to add four code snippets.
1. Add the following buildscript:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'
3. Add the Fabric Maven repository:
repositories {
maven { url 'https://maven.fabric.io/public'}
}
4. Add the following to your dependencies:maven { url 'https://maven.fabric.io/public'}
}
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
}
AndroidManifest.xmlAdd your API key to the AndroidManifest.xml file:
<meta-data
android:name="io.fabric.ApiKey"
android:value="<YOUR_FABRIC_API_KEY>"
/>
Request permission for your application to open network sockets:android:name="io.fabric.ApiKey"
android:value="<YOUR_FABRIC_API_KEY>"
/>
<uses-permission android:name="android.permission.INTERNET" />
MainActivity.java
In the MainActivity.java file, import the following:
import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;
In your onCreate() method, add:
Fabric.with(this, new Crashlytics());
At this point, you should be able to build your app without errors.
(Optional) To log user information that will be displayed on crash reports, you will need to add one or any combination of the following in your app (see sample):
Crashlytics.setUserIdentifier(); Crashlytics.setUserName();
Crashlytics.setUserEmail();
After setting up Crashlytics and deploying your updated app, you should get an email from Fabric letting you know a new app has been detected.Crash Notifications & Reports
By default, notifications are sent out when new issues are detected or issues are regressed. You can customize these settings. However, I recommend leaving important notifications on.The Crashlytics Dashboard lets you monitor the health of your app in real-time. It shows you details like number of crashes, percentage of crash-free users, and which users are impacted by each crash; so you are able to identify and prioritize bug fixes.
If you log user information with Crashlytics, you can identify specific users impacted by certain crashes. You can provide proactive outreach acknowledging active issues and sharing possible workarounds.
_________________________________________________________________________________
Happy Coding...
Comments
Post a Comment