'React Native Android libc.so crash on first open after installation

Everything is working fine in debug mode. If I uninstall the app and reinstall from an apk, the first time is crashing. When I reopen, starts working fine.

  • React Native: 0.67.4
  • React: 18.0.0
  • Android compileSdkVersion 32
  • ndkVersion 21.4.7075529

build.gradle includes maven maven {url("$rootDir/../node_modules/jsc-android/dist")} and installed jsc-android version is 250230.2.1 (it's added automatically)

2022-05-02 17:34:43.291 31541-31541/? A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x48 in tid 31541 (dev.wilav), pid 31541 (dev.wilav)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: Build fingerprint: 'samsung/r0qxxx/r0q:12/SP1A.210812.016/S901EXXU1AVCJ:user/release-keys'
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: Revision: '13'
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: ABI: 'arm64'
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: Processor: '6'
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: Timestamp: 2022-05-02 17:34:43.403049627-0300
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: Process uptime: 8s
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: Cmdline: dev.wilav
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: pid: 31541, tid: 31541, name: dev.wilav  >>> dev.wilav <<<
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: uid: 10750
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: tagged_addr_ctrl: 0000000000000001
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x48
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: Cause: null pointer dereference
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:     x0  000000000000000a  x1  0000007fd7fe2330  x2  0000007fd7fe23b0  x3  0000000000001286
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:     x4  0000000000000000  x5  0000000000000008  x6  000000006f3cd410  x7  000000006ff836d8
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:     x8  00000076f11cac10  x9  0000000000000000  x10 0000007823d06000  x11 00000000000000e0
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:     x12 0000000000000017  x13 0000000019f645d0  x14 000000000ba350b0  x15 00000babf1e10eee
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:     x16 0000007a7f1a4d50  x17 0000007a8a54ee24  x18 0000007a9ee0c000  x19 b400007833d02d10
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:     x20 0000000000000000  x21 0000000000001286  x22 0000000000001286  x23 b400007833d02d10
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:     x24 000000007fffffff  x25 0000007a9e20e000  x26 0000000015180000  x27 b4000077c3d7b120
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:     x28 000000006f476c68  x29 0000007fd7fe3580
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:     lr  0000007a9f3b689c  sp  0000007fd7fe2310  pc  00000076f0f9f3bc  pst 0000000060001000
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG: backtrace:
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #00 pc 00000000006703bc  /data/app/~~W6WxLFf0lAgav9RnC1zd9w==/dev.wilav-MbM1NCrTCJZCjYopf93dSQ==/lib/arm64/libjsc.so (BuildId: dad225e5c5aafb43e3fcbfcd576772a6a0f8c19a)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #01 pc 000000000000089c  [vdso]
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #02 pc 00000000000a30b8  /apex/com.android.runtime/lib64/bionic/libc.so (__epoll_pwait+8) (BuildId: ea614e5d67d01effce7dc685388edeee)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #03 pc 0000000000017ea8  /system/lib64/libutils.so (android::Looper::pollInner(int)+184) (BuildId: 748948a5650ad93d18b12eb1d9a51a89)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #04 pc 0000000000017d84  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+116) (BuildId: 748948a5650ad93d18b12eb1d9a51a89)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #05 pc 000000000015917c  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+48) (BuildId: 84bf0c41679a7cdc7963b099e071b348)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #06 pc 000000000028544c  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot-framework.oat (art_jni_trampoline+108)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #07 pc 00000000007ecd28  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot-framework.oat (android.os.MessageQueue.next+232)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #08 pc 00000000007e9f14  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot-framework.oat (android.os.Looper.loopOnce+100)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #09 pc 00000000007e9e14  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot-framework.oat (android.os.Looper.loop+516)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #10 pc 0000000000565d70  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot-framework.oat (android.app.ActivityThread.main+800)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #11 pc 00000000002ca9e8  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #12 pc 000000000035b5d0  /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+608) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #13 pc 000000000035b348  /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+52) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #14 pc 00000000000b2f74  /apex/com.android.art/javalib/arm64/boot.oat (art_jni_trampoline+132) (BuildId: ad9ee401645a5135206a62ff86fc2ef5cdc29120)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #15 pc 0000000000b3e04c  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot-framework.oat (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+140)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #16 pc 0000000000b474a8  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot-framework.oat (com.android.internal.os.ZygoteInit.main+2376)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #17 pc 00000000002ca9e8  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #18 pc 000000000044ca04  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+464) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #19 pc 000000000062cf30  /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+268) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #20 pc 00000000000b3bf8  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+124) (BuildId: 84bf0c41679a7cdc7963b099e071b348)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #21 pc 00000000000c01e4  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+852) (BuildId: 84bf0c41679a7cdc7963b099e071b348)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #22 pc 00000000000025d0  /system/bin/app_process64 (main+1400) (BuildId: bce2def038894c7d698a2968af787809)
2022-05-02 17:34:43.903 32397-32397/? A/DEBUG:       #23 pc 000000000004a068  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+100) (BuildId: ea614e5d67d01effce7dc685388edeee)```


Solution 1:[1]

It's still an open issue on RN repo since February 2022, you can find more details there.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 glava11