Sample App: A Demonstration of the Differences Between Fabric and Firebase


From left to right: Crashes/custom fields screen, and Events screen.


This Sample App is a demonstration created to highlight the key differences between implementing Crashlytics and event tracking code in a Fabric and Firebase on-boarded app.

This guide serves as a starting point for some of the ways you can incorporate practical Crashlytics and Fabric Answers/Google Analytics for Firebase events into your apps code.


We also migrated the Sample App for Apple. It’s open sourced on GitHub. Depending on which folder you access, you can view the Fabric or Firebase implementation. You can also read the tutorial to build the Sample App for Apple.

Getting Started


To properly follow along with this guide a basic knowledge of Github, and Android Studio will be necessary. You will also need a Google account as well as access to the Firebase Console.

Creating a Firebase project

Firebase, Crashlytics’ new home, organizes apps in a similar way to Fabric. A Firebase project is similar to a Fabric organization.

When we on-boarded the Sample App, we created a single Firebase project that contains both the Android and iOS versions of the app. We’d recommend you do the same for your cross-platform apps to take advantage of having shared Firebase features like Realtime Database. However, for apps that are completely different (e.g. ChatApp and CasinoApp), we’d recommend making different projects.

Transition Options

OPTION 1: (Preferred)

We strongly recommend that you migrate with your historical Crashlytics data by visiting the migration page. After you have migrated using the migration page, please skip to step 5.

OPTION 2: Start Fresh

If you’d like to start in Firebase without your previous Fabric data, please follow these steps:

Step 1. Remove the Fabric API Key.

The Fabric API key needs to be removed from the AndroidManifest.xml file in order to on-board with Firebase.

Step 2. Remove the Fabric initialization code.

First, remove the file.

We’ll need to remove Fabric from our app-level build.gradle by doing the following:

  1. Remove the buildConfigTypes in the buildTypes section of your app/build.gradle.
  2. Remove Fabric dependencies in app/build.gradle.
  3. Remove any references to the file.
  4. Remove any import; and Fabric.with() statements from your project.

Step 3: Add Firebase to your app.

To add Firebase to your app, follow along in the Firebase Documentation.

Here are the code changes we’ve made to our main so far:

--- _static/diffs/
+++ _static/diffs/
@@ -1,4 +1,4 @@
 public class App extends Application {
     private static App singleton;
@@ -14,7 +14,7 @@
         singleton = this;
-        Fabric.with(this, new Crashlytics(), new Digits(), new Twitter(authConfig), new MoPub());
+        FirebaseApp.initializeApp(this);
     private void extractAvenir() {

Step 4. Set up Firebase Crashlytics.

To set up Firebase Crashlytics, follow along in the Firebase Documentation on Getting started with Firebase Crashlytics.

Note: In your app-level build.gradle, be sure to update your Crashlytics dependency to the latest version. Also, to get the full features of Crashlytics, include firebase-core.

Once you finish setting up Firebase Crashlytics, you can test your implementation by forcing a test crash in your app.

Step 5: Convert Fabric Answers to Google Analytics for Firebase.

Google Analytics for Firebase (often just called Analytics) provides the same powerful insights as Answers while integrating closely with the rest of the Firebase suite.

Analytics provides many predefined events that we recommend you use. Here’s a table of Answers events and their corresponding Analytics events:

Answers Event Analytics Event
logAddToCart ADD_TO_CART
logStartCheckout BEGIN_CHECKOUT
logContentView VIEW_ITEM
logSearch SEARCH
logShare SHARE
logRating (No direct corollary)
logSignUp SIGN_UP
logLogin LOGIN
logInvite (No direct corollary) Maybe: SHARE
logLevelStart LEVEL_START
logLevelEnd LEVEL_END

To migrate your Answers code to Analytics, check the getting started guide to make sure you’ve included the necessary dependencies and startup code. If you’ve already initialized Firebase in your app, you can skip ahead to the section titled “Log Events”.

Then, change your Answers logFoo statements (where Foo is an Answers Event in the table above) to FirebaseAnalytics.logEvent using the appropriate event listed in the above table or your own custom event (use your own string instead of one of the constants available in the Firebase library).

The Analytics documentation shows parameters relevant to each predefined event, but you can always add customer parameters too. Instead of using one of the available constants, you can use any string you’d like. Then, register that parameter in the Firebase Console.

If an Analytics event is especially important to your business (such as a user spending money, or completing a critical flow in the app), you can configure it as a conversion.

Read more about how to log events (including how to attach relevant parameters) here.

Contact Support

Feel free to reach out to us if you run into any trouble at: