React-native-firebase: Can't manually crash app to turn on or test Crashlytics

Created on 28 Jul 2020  路  11Comments  路  Source: invertase/react-native-firebase

After installing Crashlytics into ReactNative v0.62.2, I'm getting an error when running a if (crashlytics().isCrashlyticsCollectionEnabled) crashlytics().crash();

Screen Shot 2020-07-28 at 3 44 55 PM

which points at this method in Crashlytics:

RCT_EXPORT_METHOD(crash) {
  if ([RNFBCrashlyticsInitProvider isCrashlyticsCollectionEnabled]) {
    assert(NO);
  }
}

my steps in the setup of Crashlytics

I already have the firebase app connected to a firebase database.

I simply yarn add @react-native-firebase/crashlytics && cd ./ios/ && pod install --repo-update. The app build fine. I added if (crashlytics().isCrashlyticsCollectionEnabled) crashlytics().crash(); to a button onPress. I then get the above error.

I tried to push up to TestFlight

I even pushed a build to TestFlight and was able to crash my app. Sadly, nothing showed in Firebase Crashlytics. Here is what I still see in the Firebase app:

Screen Shot 2020-07-28 at 4 17 51 PM

iOS Solution Provided Crashlytics

Most helpful comment

I am facing the same issue as well. Adding: { "react-native": { "crashlytics_debug_enabled": true } } to firebase.json did not help.

All 11 comments

The code itself isn't the problem - crash() is doing its job. It's crashing your app using an assert on false (which will always cause a crash). I think maybe Xcode is actively preventing the crash from happening (is that possible? 馃憖)

As for the crashes not showing up on the console: If this is a dev build (are Test flight deployments considered dev builds?), this is intentional - you have to enable crashlytics on for dev builds in your firebase.json. Check the docs for that.

I am facing the same issue as well. Adding: { "react-native": { "crashlytics_debug_enabled": true } } to firebase.json did not help.

Update. I was able to set-up Crashlytics by building the app using release scheme on Xcode and then following steps from firebase:

Test it out
The code snippet above adds a button that crashes your app when pressed. For it to work, run the app without a debugger:

  • Click Build and then run the current scheme in Xcode to build your app on a device or simulator.

  • Click Stop running the scheme or action in Xcode to close the initial instance of your app. This initial instance includes a debugger that interferes with Crashlytics.

  • Open your app again from the simulator or device.

  • Touch Crash to crash the app.

  • Open your app once more to let the Crashlytics API report the crash. Your crash should show up in the Firebase console within 5 minutes.

https://firebase.google.com/docs/crashlytics/test-implementation?authuser=0#test_it_out

update # 2: With a fresh start, I'm trying to add crashlytics again...

update # 1: Now, I see two crashes from yesterday and one from today. How long does it take to see crash data in firebase?


oooh, that was helpful info.

I did the following:

  • turned on the release scheme and did a build
  • stopped the Xcode build and reopened the simulator app
  • I crashed the app 馃憤
  • reopened the app
  • waited 5-30mins for firebase console to show crash data
  • still not seeing any results in firebase console 馃槥

I tried with and without this in firebase.json:

{
  "react-native": {
    "crashlytics_debug_enabled": true
  }
}

I'm still having the same problem.

I believe the current state of play for this is best captured on a related issue, starting at this comment https://github.com/invertase/react-native-firebase/issues/3879#issuecomment-676966635 @jimmyceroneii

Thanks @mikehardy! My issue just miraculously resolved after what felt like forever. Not sure what fixed it but I'll try to throw it in here (or #3879) if I can figure it out.

starting to get more success reports than failure reports, it's encouraging - thanks @jimmyceroneii for reporting back

We believe this is resolved, our effort was focused on this thread: https://github.com/invertase/react-native-firebase/issues/3879#issuecomment-678389795 - we will reopen there if it continues

I also have an issue when I try to test the app crash. It looks like so
Screenshot 2020-12-23 at 16 21 11

"@react-native-firebase/app": "^10.3.0",
"@react-native-firebase/auth": "^10.3.1",
"@react-native-firebase/crashlytics": "^10.3.1",
    "react-native": "0.63.3",

Please do not post images, stack traces are much better
Do not mix versions in react-native-firebase any more. They are locked in sync, which should be easier I hope - 10.3.1 for all
Please do not post on closed issues, if you have a problem please post a new issue with full details

Was this page helpful?
0 / 5 - 0 ratings