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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?