【问题标题】:React native crash on android (RuntimeException)在android上反应本机崩溃(RuntimeException)
【发布时间】:2022-01-22 07:01:26
【问题描述】:

我收到报告称我们的 React Native 应用程序在启动时在 Android 上发生了崩溃,但它不是我能够在本地或使用我必须使用的任何设备重新创建的崩溃。崩溃发生在我们的应用程序中初始化 Sentry 之前,因此除了来自一个用户设备的日志之外,能够诊断它的信息非常有限

2021-12-20 17:27:38,487 - [INFO::com.miui.bugreport] - BaseConstants: com.miui.cloudservice existence = true
2021-12-20 17:27:38,489 - [INFO::com.miui.bugreport] - BaseConstants: com.miui.bugreport existence = true
2021-12-20 17:27:39,038 - [INFO::com.miui.bugreport] - Utils: Current process is main process.
2021-12-20 17:27:39,067 - [INFO::com.miui.bugreport] - BugreportPushMessageReceiver: Push register success.
2021-12-20 17:27:39,068 - [INFO::com.miui.bugreport] - Utils: Current process is main process.
2021-12-20 17:27:40,199 - [INFO::com.miui.bugreport] - BugreportGenerateService: set sender package name. com.android.settings
2021-12-20 17:27:45,237 - [ERROR::com.miui.bugreport] - ReflectClass: Failed to call static method:set
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at b.d.e.a.a.c.b.a(SourceFile:10)
    at b.d.e.a.a.c.a.a(SourceFile:11)
    at b.d.e.a.a.c.a.a.b.b(SourceFile:2)
    at com.miui.bugreport.service.i.a(SourceFile:39)
    at com.miui.bugreport.service.BugreportGenerateService.a(SourceFile:67)
    at com.miui.bugreport.service.BugreportGenerateService.onHandleIntent(SourceFile:12)
    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:77)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:236)
    at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.RuntimeException: failed to set system property (check logcat for reason)
    at android.os.SystemProperties.native_set(Native Method)
    at android.os.SystemProperties.set(SystemProperties.java:240)
    ... 11 more
2021-12-20 17:27:45,238 - [INFO::com.miui.bugreport] - BugreportGenerateService: Starts to dump Bugreport
2021-12-20 17:27:45,242 - [INFO::com.miui.bugreport] - DumpLogUtil: Starts to dump bugreport log to path=/storage/emulated/0/MIUI/debug_log//tmp/bugreport_1640017665238.log.tmp
2021-12-20 17:30:36,607 - [INFO::com.miui.bugreport] - DumpLogUtil: Bugreport file name = bugreport-galahad_eea-RP1A.200720.011-2021-12-20-17-27-45.zip
2021-12-20 17:30:41,631 - [INFO::com.miui.bugreport] - DumpLogUtil: Reads end of dumpstatez
2021-12-20 17:30:41,633 - [INFO::com.miui.bugreport] - DumpLogUtil: Dump bugreport complete and path=/storage/emulated/0/MIUI/debug_log//tmp/bugreport-galahad_eea-RP1A.200720.011-2021-12-20-17-27-45.zip

崩溃每次都会发生在某些用户身上,但并非不会发生在所有用户身上,并且只会影响 android。更新到 RN v0.66.3 后,用户首先开始崩溃。任何关于问题可能是什么或我如何获得更多有用信息来诊断此问题的想法将不胜感激!

其他可能有用的信息:

package.json:

 "dependencies": {
    "@react-native-community/async-storage": "^1.12.0",
    "@react-native-community/cli-platform-ios": "^4.13.0",
    "@react-navigation/native": "^5.8.10",
    "@sentry/react-native": "^1.8.2",
    "color": "2.0.0",
    "crypto-js": "3.1.9-1",
    "graceful-fs": "^4.2.8",
    "install": "0.10.1",
    "lodash": "^4.17.20",
    "moment": "^2.29.0",
    "npm": "^5.10.0",
    "prop-types": "^15.7.2",
    "qs": "^6.10.1",
    "react": "17.0.2",
    "react-async": "^7.0.6",
    "react-native": "0.66.3",
    "react-native-cache": "^2.0.1",
    "react-native-charts-wrapper": "^0.5.7",
    "react-native-config": "^0.12.0",
    "react-native-daterange-picker": "^1.5.1",
    "react-native-gesture-handler": "^1.8.0",
    "react-native-get-random-values": "^1.5.0",
    "react-native-haptic-feedback": "^1.11.0",
    "react-native-inappbrowser-reborn": "^3.6.3",
    "react-native-keychain": "^4.0.5",
    "react-native-mixpanel": "^1.2.5",
    "react-native-modal": "^10.0.0",
    "react-native-onesignal": "^3.6.4",
    "react-native-reanimated": "^1.13.0",
    "react-native-router-flux": "^4.2.0",
    "react-native-screens": "^2.11.0",
    "react-native-search-box": "0.0.19",
    "react-native-share": "^2.0.0",
    "react-native-star-rating": "^1.1.0",
    "react-native-svg": "^9.13.6",
    "react-native-svg-charts": "^5.4.0",
    "react-native-swipeable": "^0.6.0",
    "react-native-table-component": "^1.2.1",
    "react-native-vector-icons": "^4.4.0",
    "react-redux": "5.0.6",
    "redux": "3.7.2",
    "redux-thunk": "2.2.0",
    "smartlook-react-native-wrapper": "^0.24.0",
    "uuid": "^8.3.2"
  },
  "devDependencies": {
    "@types/react": "^16.9.49",
    "@types/react-native": "^0.61.23",
    "@typescript-eslint/eslint-plugin": "^1.13.0",
    "@typescript-eslint/parser": "^1.13.0",
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.66.2",
    "react-test-renderer": "17.0.2",
    "babel-cli": "6.26.0",
    "babel-core": "6.26.0",
    "babel-eslint": "^10.1.0",
    "babel-preset-airbnb": "2.4.0",
    "chai": "4.1.2",
    "chai-enzyme": "0.8.0",
    "enzyme": "3.1.0",
    "eslint-config-react-app": "^5.2.1",
    "eslint-plugin-flowtype": "^3.13.0",
    "eslint-plugin-import": "^2.22.0",
    "eslint-plugin-jsx-a11y": "^6.3.1",
    "eslint-plugin-react": "^7.21.1",
    "eslint-plugin-react-hooks": "^1.7.0",
    "fetch-mock": "5.12.2",
    "husky": "^3.1.0",
    "jsdom": "11.3.0",
    "lint-staged": "^9.5.0",
    "mocha": "4.0.0",
    "prettier": "^1.19.1",
    "react-dom": "^16.13.1",
    "react-native-debugger-open": "^0.3.25",
    "react-native-mock": "0.3.1",
    "react-native-mock-render": "^0.1.9",
    "redux-mock-store": "1.3.0",
    "regenerator-runtime": "^0.13.7",
    "sinon": "4.0.1",
    "sinon-chai": "2.14.0",
    "timekeeper": "2.0.0",
    "underscore": "1.8.3"
  },

build.gradle:

buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
supportLibVersion = "30.0.0"
googlePlayServicesVersion = "16.0.0"
googlePlayServicesVisionVersion = "17.0.2"
ndkVersion = "21.4.7075529"

【问题讨论】:

    标签: android react-native crash


    【解决方案1】:

    如果有其他人遇到同样的问题,请查明真相。

    问题在于 Sentry 的初始化,因为它使用了旧版本和更高版本的 React Native(但仅在少数 Android 设备上发生)。问题已通过从 v1.8.2 升级到 v3.2.10 解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-01
      • 1970-01-01
      • 2023-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-15
      • 1970-01-01
      相关资源
      最近更新 更多