react-native-exceptions-manager

React-Native Crash Reporter

  • 所有者: Richard-Cao/react-native-exceptions-manager
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

react-native-exceptions-manager

GitHub license
NPM version
Dependency Status
Downloads

React-Native Crash Reporter In Release Version(Do not trigger native crash).

Linking

Android

  • Add following lines into android/settings.gradle
include ':react-native-exceptions-manager'
project(':react-native-exceptions-manager').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-exceptions-manager/android/app')
  • Add following lines into your android/app/build.gradle in section dependencies
compile project(':react-native-exceptions-manager')
  • Add following lines into MainApplication.java
import com.richardcao.exceptionsmanager.react.ExceptionsManager;
...

@Override
protected List<ReactPackage> getPackages() {
    List<ReactPackage> packages = Arrays.asList(
            new MainReactPackage(),
            ...);
    ArrayList<ReactPackage> packageList = new ArrayList<>(packages);
    if (!BuildConfig.DEBUG) {
        packageList.add(new ExceptionsManager());
    }
    return packageList;
}
  • Create a class named ReactNativeJSCrashReceiver in it. This is needed to get js crash message from react-native-exceptions-manager.
public class ReactNativeJSCrashReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals("com.richardcao.android.REACT_NATIVE_CRASH_REPORT_ACTION")) {
            Throwable js = (Throwable) intent.getSerializableExtra("JavascriptException");
            ...(handler or report js crash operate)
            Throwable e = (Throwable) intent.getSerializableExtra("Exception");
            ...(handler or report native crash operate)
        }
    }
}
  • Add ReactNativeJSCrashReceiver declare in your AndroidManifest.xml
<application
    android:name=".MainApplication"
    android:allowBackup="true"
    ...>
    ...
    <receiver android:name=".ReactNativeJSCrashReceiver">
        <intent-filter>
            <action android:name="com.richardcao.android.REACT_NATIVE_CRASH_REPORT_ACTION" />
        </intent-filter>
    </receiver>
</application>

iOS

//TODO

Who Use It

MIT Licensed

主要指标

概览
名称与所有者Richard-Cao/react-native-exceptions-manager
主编程语言Java
编程语言Java (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2016-09-29 09:04:04
推送于2017-08-04 08:30:25
最后一次提交2017-08-04 16:27:57
发布数6
最新版本名称v0.2.0 (发布于 )
第一版名称v0.1.5 (发布于 )
用户参与
星数29
关注者数1
派生数1
提交数13
已启用问题?
问题数1
打开的问题数0
拉请求数0
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?