反应本机崩溃:线程:SIGSEGV libjsc.so

Guf*_*hid 5 android react-native android-native-library

我们在 android 设备的各个随机位置发生以下崩溃。虽然我们已经将 ndk abifilters 更改为“armeabi-v7a”、“arm64-v8a”

  Crashed: Thread :  SIGSEGV  0x0000000000000010
  #00 pc 0x723d46f748 libjsc.so 
  #01 pc 0x723d4bbfe8 libjsc.so 
  #02 pc 0x7339d68b6c libc.so 
Run Code Online (Sandbox Code Playgroud)

当前配置

RN 版本 0.63.4

 defaultConfig {
    ..
    ndk { abiFilters  "armeabi-v7a", "arm64-v8a" }
}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a",
                "x86", "arm64-v8a", "x86_64"
    }
}

 project.ext.react = [
    entryFile   : "index.js",
    enableHermes: false,  // clean and rebuild if changing
 ]
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

在此处输入图片说明

Sat*_*ran 10

我仅在 Android RN 0.59.5 上使用 JSC 时遇到过此类问题,唯一的方法是升级 JSC。

这个问题是由于 JSC 深处发生的内存问题造成的,我们对此几乎无能为力。

请参阅这些主题以获取更多信息:

https://github.com/facebook/react-native/issues/24261

https://github.com/facebook/react-native/pull/25426/files

但由于您已经在使用 RN 版本 0.63.4,唯一的方法是取消 JSC 并启用 Hermes。Hermes 提供了很多性能优化,例如字节码、更快的冷启动等。请在此处阅读更多内容。

如果您愿意,可以在react-native/package.json中检查应用程序中使用的JSC版本,看看是否可以进一步升级。

  • 我在react-native 0.63.2上有同样的错误,使用jsc-android:^245459.0.0,并且我从这篇文章https://github.com/facebook/react-native/issues/24261中进行了所有更改,但是无论如何,每次在生产模式下都会出现错误。有什么新的想法如何解决吗? (2认同)

Raj*_*sit 7

如果您正在使用 webview 并面临问题,请在出现问题的屏幕中放置animationEnabled: false

<Stack.Screen
        name="CampaygnsDetail"
        component={CampaygnsDetail}
        options={{
          animationEnabled: false,
        }}
        />
Run Code Online (Sandbox Code Playgroud)