Unable to find meaningful logs for ReactNative using Crashlytics

此生再无相见时 提交于 2020-01-02 18:38:18

问题


I have integrated Crashlytic in reactNative application and tried to check crash logs generated from js files. Its able to capture them but not providing information about the file name. Logs are giving location from index.android.bundle file which are hard to provide any information about crash location. I have already tried

  • react-native-fabric-crashlytics and react-native-fabric npm modules
  • Setting default logger for react native as mentioned in
    https://www.mojotech.com/blog/fabric-integration-for-react-native-on-android/

but there is no use. Still logs are coming as mentioned below

Fatal Exception: com.facebook.react.common.JavascriptException: ReferenceError: Can't find variable: Button2

This error is located at:
    in t
    in Connect(t)
    in n
    in s
    in RCTView
    in RCTView
    in t, stack:
value@352:2655
u@49:81049
beginWork@49:83749
n@49:112665
i@49:112995
a@49:113436
P@49:118122
k@49:117558
T@49:116698
h@49:115914
d@49:115602
t@49:66915
updateContainer@49:133602
render@49:72179
exports@284:730
run@280:615
runApplication@280:2046
value@27:3582
<unknown>@27:1067
value@27:3009
value@27:1039

       at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:56)
       at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:40)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:374)
       at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:162)
       at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:790)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
       at android.os.Looper.loop(Looper.java:164)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)
       at java.lang.Thread.run(Thread.java:764)

回答1:


I know without source maps, it is very difficult to understand the logs. I've made some changes in the react-native default error handler and throwing some native exceptions too. Here is my article on it. Let me know if this helps.

Using Crashlytics with React Native Android App




回答2:


I think the reason is that you generate your bundle with --dev false. Try to build your bundle with --dev true. It will generate unminified (e.g. normal) Javascript.

react-native bundle --platform android --dev true --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/


来源:https://stackoverflow.com/questions/50480099/unable-to-find-meaningful-logs-for-reactnative-using-crashlytics

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!