react-native – React Native崩溃报告有什么好的设置?
我看到getSentry现在有React Native的崩溃报告:
https://docs.getsentry.com/hosted/clients/javascript/integrations/react-native/ 我喜欢他们,因为他们很好地将异常与您的源地图相关联.但我也想抓住本机崩溃.你基本上要设置getSentry和Crashlytics吗? 这是讨论各种选项的主题: https://github.com/facebook/react-native/issues/5378 这是一个看似很好但有点迂回的hokeyapp解决方案: 我想知道人们在生产中成功使用什么来捕获原生和javascript崩溃与详细的源地图感知报告? 解决方法
我是
react-native-bugsnag的作者.
我不是公司的附属公司,但我喜欢他们的仪表板和他们的定价模型,所以我为我们创建了这个库本地程序员,以便有办法使用他们的服务. [TL / DR]: 1)复制下面的脚本,将其添加到项目根目录, 2)更改脚本开头的版本以匹配您的react-native项目的本机部分的版本. 3)运行它: sh crash_report.sh -i< BUGSNAG_KEY>捆绑和上传你的ios源图, 要么 sh crash_report.sh -a< BUGSNAG_KEY>捆绑和上传你的Android源图. [LONGER VERSION]: official react-native bugsnag sdk现已发布. 它支持iOS / Android和Javascript处理和无法处理的崩溃报告. 让我解释一下我是怎么做到的: 我创建了一个名为crash_report.sh的文件来创建我的项目源图,并将它们上传到bugsnag以及我的所有项目文件,以便我可以看到如下所示的丰富错误报告: 要使用它,您只需将其添加到项目根文件夹,将版本变量(appVersion)更改为您的xcode项目所具有的任何版本,或者您的android studio项目. crash_report.sh: #!/bin/bash appVersion='1.0.0' # IMPORTANT,this has to be the same as the version of your native project in xcode or android studio. # Get shell args aflag='' iflag='' platform='' bugsnagKey='' while getopts 'i:a:' flag; do case "${flag}" in a) aflag='true' bugsnagKey=$OPTARG ;; i) iflag='true' bugsnagKey=$OPTARG ;; *) printf "Usage: %s: [-a] [-i] argsn" $0 esac done if [ -n "$aflag" ] && [ -z "$iflag" ]; then printf "Now bundling for android.n" platform='android' fi if [ -n "$iflag" ] && [ -z "$aflag" ]; then printf "Now bundling for ios.n" platform='ios' fi if [ -z "$platform" ]; then printf "nUsage: <script> -i <BUGSNAG_KEY> OR -a <BUGSNAG_KEY>. nTerminating...nn" else printf "Now fetching project properties from package.jsonn" echo 'Now creating sourcemapsn App version: '${appVersion}' for platform: '${platform} # #Create iOS sourcemaps react-native bundle --dev false --platform ${platform} --entry-file index.${platform}.js --bundle-output main.${platform}.jsbundle --sourcemap-output main.${platform}.jsbundle.map echo 'Now uploading with key: '${bugsnagKey}' for version '${appVersion} CUR_DIRR=`pwd` # Get current directory CUR_DIRR=${CUR_DIRR}'/' # Append a forward slash to it # Here we get ALL the project files,and form them as curl params,so that we can later on pass them to curl PROJECT_FILES=$(find src -name '*.js' | while read -r i; do echo '-F '$CUR_DIRR$i'=@'$i; done) # Form the right file ending for curl # echo ${PROJECT_FILES} # #Upload iOS sourcemaps curl -w "nn%{http_code}n" --progress-bar -F apiKey=${bugsnagKey} -F appVersion=${appVersion} -F minifiedUrl="main.jsbundle" -F sourceMap=@main.${platform}.jsbundle.map -F minifiedFile=@main.${platform}.jsbundle -F overwrite=true ${PROJECT_FILES} https://upload.bugsnag.com echo 'nDone.n' fi 我希望这对某人有所帮助,这花了我几个小时的时间.玩得开心..! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |