带有 firebase crashlytics 的 Hermes 包的反应本机源图

2024-03-28

我想从react-native应用程序中读取crashlytics报告,但它在firebase控制台中根本不可读。 Android 的崩溃示例如下所示:

Non-fatal Exception: io.invertase.firebase.crashlytics.UnhandledPromiseRejection
Invalid RegExp pattern: Parenthesized expression not closed
.RegExp ((native):0:0)
.anonymous (address at index.android.bundle:1:2065589)
.ue (address at index.android.bundle:1:2070284)
.ce (address at index.android.bundle:1:2069288)
.Be (address at index.android.bundle:1:2080135)

我启用了 Hermes,并生成了我签名的构建 apkindex.android.bundle以预编译格式(build/generated/assets/react/appName/release/index.android.bundle)与源映射文件build/sourcemaps/react/appName/release/index.android.bundle.map。我尝试使用 npm 包读取这些文件source-map-explorer但不幸的是它总是产生以下错误:

source-map-explorer index.android.bundle index.android.bundle.map 
index.android.bundle
  Your source map refers to generated column 165922 on line 1, but the source only contains 165920 column(s) on that line.
  Check that you are using the correct source map.
  1. 我可以将源映射上传到 firebase 以便在 firebase 控制台中读取错误吗?
  2. 如何使用 sourcemap 读取 Hermes 捆绑文件?

你只需要使用

npx metro-symbolicate android/app/build/generated/sourcemaps/react/release/index.android.bundle.map < stacktrace.txt

将您的堆栈跟踪放入 stacktrack.txt 中。 (删除 0:0 即可生效)

欲了解更多信息,请访问https://reactnative.dev/docs/next/symbolication https://reactnative.dev/docs/next/symbolication

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

带有 firebase crashlytics 的 Hermes 包的反应本机源图 的相关文章

随机推荐