强制崩溃反应本机应用程序以进行错误测试

时间:2019-05-17 11:55:28

标签: android react-native crash bugsnag

有什么方法可以迫使崩溃对本地生产apk做出反应?

我知道Crashlytics.crash();的结构中有一个选项,但是我不想使用Crashlytics,因为我已经在使用bugsnag。

2 个答案:

答案 0 :(得分:1)

您需要在初始文件中导入包react-native-fabric和另一行。

import Fabric from 'react-native-fabric';
var { Crashlytics } = Fabric;
Crashlytics.crash();

答案 1 :(得分:1)

查看Bugsnag React Native示例应用程序,了解有关如何触发崩溃进行测试的一些示例: https://github.com/bugsnag/bugsnag-react-native/tree/master/examples/plain

例如触发本机崩溃:

https://github.com/bugsnag/bugsnag-react-native/blob/84f9cd639c2e38231616d15a85eba153da14a70e/examples/plain/app/index.js#L16

使用:

https://github.com/bugsnag/bugsnag-react-native/blob/master/examples/plain/app/lib/native_crash.js

如果需要进一步的帮助,请联系Bugsnag支持。