How to setup crashlytics in react native
Crashlytics Setup: App crashing is a most important part of app development, sometimes we see everything working fine in debug mode but when we generate and install the app, app getting crashed and we didnʼt find any relevant reason for crashing, so tod/y I am going discuss about app crashing using fabric and crashlytics.
Crashlytics is a part of Fabric, an SDK offered by Twitter with a set of tools that will help you a lot while developing mobile apps.
Crashlytics is a #1 most implemented performance SDK.
There are 2 important features which we going to use.
Crash Reporting — It records every crash and maintains its stack trace.
Crash Logs — when a user crashes your app, all the information will be sent to Crashlyticsʼs servers the next time the user launches your app, including all the content that youʼve logged through CLS_LOG. So if you log information for most of the events of the action in your app, you can read the logs later and reproducing the crash should be simple.
Before you begin — Before set up Crashlytics, you need to register your iOS app and configure it to use Firebase, if you didnʼt add your project with firebase then please follow this(link of firebase project) or If your iOS app already uses Firebase, then it’s already registered and configured for Firebase, then no need to register new app. after successfully add project we going further discussion.
Note — adding Firebase to your iOS /pp involves tasks both in the Firebase console and in your open Xcode project, so open both.
Set up Crashlytics in the Firebase console:
- Step 1: Click Crashlytics in the left sidemen under the quality of the Firebase console, looks like.
- Step 2: If you registered more than one app in your Firebase then select the app you just added from the dropdown next to Crashlytics in the top bar of the console, looks like. Select your project here just looks.
- Step 3: Click on Set up Crashlytics.
- Step 4: Select the setup of a new firebase app and click next.
Add the Crashlytics SDK in your project: There is a 2 way to add fabric and crashlytics in-app.
1. Adding fabric and crashlytics using cocoa pods.
2. Adding fabric and crashlytics Manually in Xcode.
- Step 1: Adding fabric and crashlytics using cocoa pods:
- Open a new terminal window, and navigate to your Xcode project’s directory like – myproject->ios.
- Then open the project in the editor and add these lines ==
- # Pods for PodTest
- pod ‘Fabric’, ‘~> 1.10.2’
- pod ‘Crashlytics’, ‘~> 3.14.0’ –
- Remove the old pod’s folder and podlock file – From your terminal, install the pod’s dependencies:
- pod install
- Step 2: Adding fabric and crashlytics Manually in Xcode: – Download the Crashlytics SDK. – Unzip the SDK, then drag Crashlytics.framework and Fabric.framework into your project’s Project navigator.
- Ensure that Copy item if necessary is selected, then click Finish.
- Initialize Crashlytics in your Xcode: The frameworks you added to include a run script that initializes Crashlytics. Add it to your project’s build phases.
- – Open your project in Xcode, then select a project from the navbar.
- – Select your main build target from the Select a project or target dropdown.
- – Open the target’s Build Phases tab.
- – Click + Add a new build phase, then select New Run Script Phase.
- – Add the following line to the Type a script text box, after all these steps your window is like.
- Build or run your project: – First, build the project(cmd+B)
- – Then run the project in the device and put some code that crashes the app so you can able to see the crash report.
- Setup dSYMs for crashlytics for iOS devices: in quality->crashlytics you find 2 – different tabs one is dashboard and other is dSYMs, looks like
For this, you find your dSYM files and zip it then upload that files here. Now the question is where you find your dSYM files, so letʼs start to find dSYM, follow these steps.
- Step 1: go to window -> orgniser-> right-click -> select open in finder, window Is looks like
- Step 2: after open project show in finder, window Is looks like
- Step 3: after click show package contents, the window Is looks like.
- Step 4: Make the zip of .dSYM files and upload them on firebase.
- After successfully setup crashlytics you can see your crash report in the dashboard of firebase crashlytics looks like.
And if any other issue then please comment.
Happy Coding Guyz