React Native Firebase Crash Report

React, ReactNative, Firebase, Crash, Crash Report, Custom Log, Crash Custom Log, Crash Report Custom Log
npm install react-native-firebase-crash-report@1.3.0


React Native Firebase Crash Report

npm version npm downloads

React Native Firebase Crash Report With Custom Log


If you're using React Native >= 0.40, make sure to use react-native-firebase-crash-report >= 1.2.0


import FirebaseCrash from 'react-native-firebase-crash-report';

 * Create custom log messages that will be included in the crash report

FirebaseCrash.log('User logged in');

 * Create custom log messages that will be included in the crash report and output to logcat/NSLog

FirebaseCrash.logcat('User logged in');

// Android only
// Params:
// - message: string, required
// - debug level: int, optional, default 3 (
// - tag: string, optional, default 'RNFirebaseCrashReport'
FirebaseCrash.logcat('User logged in', 3, 'MyTag');

 * Report errors on demand
 * iOS Note: calling this API on iOS will result in app crash
 */'A weird thing just happened...');


Install node module

npm install --save react-native-firebase-crash-report

Linking libraries

rnpm link react-native-firebase-crash-report

iOS Configuration

Install Firebase From Cocoapods

For more information please visit Set Up Crash Reporting For iOS


If you are using RN < 0.29 you would have run into this problem, just follow the PR to fix it manually.

Go to your project's ios folder

cd <your_project>/ios

(Optional) Initialise Pod

Note: You can skip this step if you have pod initialised already.

pod init

Add pod 'Firebase/Core' and pod 'Firebase/Crash' to Podfile

 target 'YourProject' do
   # Uncomment this line if you're using Swift or would like to use dynamic frameworks

   # Pods for YourProject
+  pod 'Firebase/Core'
+  pod 'Firebase/Crash'

   target 'YourProjectTests' do
     inherit! :search_paths
     # Pods for testing


Install Pods

pod install

Initialise Firebase

Add following code in your AppDelegate.m

 #import "AppDelegate.h"

 #import "RCTRootView.h"

+@import Firebase;

 @implementation AppDelegate

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions


   self.window.rootViewController = rootViewController;
   [self.window makeKeyAndVisible];
+  // Use Firebase library to configure APIs
+  [FIRApp configure];
   return YES;

Android Configuration

For more information please visit Set Up Crash Reporting For Android

Upgrade Google Play Services and Google Repository

Upgrade Google Play Services and Google Repository

Add Google Services

  • In android/build.gradle
     dependencies {
         classpath ''
         classpath 'de.undercouch:gradle-download-task:2.0.0'
+        classpath ''
  • In android/app/build.gradle, add this line at the bottom of the file
apply plugin: ''

(Optional) Manually linking libraries

  • app/build.gradle
dependencies {
  compile project(':react-native-firebase-analytics')
  compile project(':react-native-firebase-crash-report') <-- add this
  • settings.gradle
include ':react-native-firebase-analytics'
project(':react-native-firebase-analytics').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase-analytics/android')

// add everything below this
include ':react-native-firebase-crash-report'
project(':react-native-firebase-crash-report').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase-crash-report/android')
import com.ianlin.RNFirebaseCrashReport.RNFirebaseCrashReportPackage; <-- add this

protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
    new MainReactPackage(),
    new FIRAnalyticsPackage(),
    new RNFirebaseCrashReportPackage(), <-- add this


Any pull requests, issue reports and suggestion are highly welcome.


ISC License (functionality equivalent to MIT License)