问题
1) I implement firebase crashlytics in my react native project.
2) I used below npm
npm install @react-native-firebase/app@alpha
react-native link @react-native-firebase/app
npm install @react-native-firebase/crashlytics@alpha
react-native link @react-native-firebase/crashlytics
3) I can do crash app by programmatically using
async forceCrash() {
firebase.crashlytics().crash();
await firebase.crashlytics().setAttributes({ something:
"something" });
firebase.crashlytics().log("A woopsie is incoming :(");
firebase.crashlytics().recordError(new Error("Error Log"));
}
- but i can't error log report in firabase console.
- Please give me your value able suggestion. where i am wrong.
回答1:
Crashlytics does not work with React Native, nor any JavaScript environment. As you can see from the documentation, it only works for native Android and iOS apps, and Unity games built on top of those platforms.
回答2:
React native is not officially supported but developers have been able to use crashlytics with React native. From your snippet of code, it seems that you are try trying make a test crash and send a non-fatal exception at the same time.
If you want to see logs on your crash report, the code should look something like this:
Crashlytics.log("Crash occurred! Bailing out...");
Make sure that you set these logs before your app crashes.
If you want to send non-fatal exception:
try {
throw new NullPointerException("It is Pointer No-Fatal Error");
} catch (Exception e) {
Crashlytics.logException(e);
// handle your exception here!
}
Logs will also appear with non-fatal exceptions as long as they were set before the exception occurs.
来源:https://stackoverflow.com/questions/56883167/i-cant-see-crash-report-of-android-in-firebase-console