react-native: App crashes on android only with signed apk on specific devices

Description

i am facing two different crashes when using a library that reports back to the app events through mEventEmitterCallback. the Library we are using is react-native-ble-manager.

The crash only happens on a signed apk and on some specific devices one of them is the A13(SM-A135F - SM-A137F). If i run the app with yarn android the app behaves normally and returns the scanned result. on the signed apk it crashes

first crash: The app launches and i do not use it, it crashes after 50-60 seconds. after my investigation i deduced it is caused because of GC, so i temporarily fixed it by editing the library code, whenever the call a function in the SpecFile that uses mEventEmitterCallback, to check if it is not null, the crash disappeared. so i was able to fully investigate the second crash. will provide the tombstone file that led me to this conclusion

second crash: The app subscribes to an event that returns a scanned device through ble. when i click the button to start scan, the app will crash when trying to report back a scanned device through mEventEmitterCallback.

now the firebase report was of no use:

Crashed: Thread: SIGSEGV  0x00000000c0deadc4
#00 pc 0x326534 libart.so (BuildId: d963fb24d06855807a6574ea74a2cf53)
#01 pc 0xba09eda6
#02 pc 0xba09e544
#03 pc 0xba09ed86
#04 pc 0x322dfe libart.so (BuildId: d963fb24d06855807a6574ea74a2cf53)
#05 pc 0xba09e544

so i investigated further with adb logcat and i was able to find where the crash was happening. Minified version of logcat:

2025-02-18	10:20:02.048	22972	22972	I		RNBleManager		DiscoverPeripheral: null
2025-02-18	10:20:02.057	2130	2397	D		BtGatt.GattService		onScanResult to scannerId: 3- eventType=0x1a, addressType=1, address=XX:XX:XX:XX:42:47, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-78, periodicAdvInt=0x0
2025-02-18	10:20:02.127	2130	2397	D		BtGatt.GattService		onScanResult to scannerId: 3- eventType=0x10, addressType=1, address=XX:XX:XX:XX:3E:98, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-58, periodicAdvInt=0x0
2025-02-18	10:20:02.264	22972	22972	F		libc		Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xc0deadc4 in tid 22972 (com.bletest), pid 22972 (com.bletest)
2025-02-18	10:20:02.340	23057	23057	I		crash_dump32		obtaining output fd from tombstoned, type: kDebuggerdTombstoneProto
2025-02-18	10:20:02.341	621	621	I		tombstoned		received crash request for pid 22972
2025-02-18	10:20:02.342	23057	23057	I		crash_dump32		performing dump of process 22972 (target tid = 22972)
2025-02-18	10:20:02.800	2130	2478	D		BtGatt.GattService		Binder is dead - unregistering scanner (3)!
2025-02-18	10:20:02.800	2130	2478	D		LeAppInfo		removeLeacReportedServerApp, appName: com.bletest
2025-02-18	10:20:02.801	802	802	I		Zygote		Process 22972 exited due to signal 11 (Segmentation fault)

since it is stating that the crash report is being dumped to tombstone, i ran adb.exe bugreport to pull the tombstone file and it contained

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/a13vensser/a13ve:14/UP1A.231005.007/A137FXXU6EXG3:user/release-keys'
Revision: '1'
ABI: 'arm'
Processor: '1'
Timestamp: 2025-02-18 10:20:02.370105320+0000
Process uptime: 11s
Cmdline: com.bletest
pid: 22972, tid: 22972, name: com.bletest  >>> com.bletest <<<
uid: 10263
signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xc0deadc4
    r0  c0dead90  r1  e42ae809  r2  0000000d  r3  000000a5
    r4  fff61294  r5  fff61284  r6  fff61274  r7  0000206e
    r8  00000000  r9  e91baa00  r10 e1630e00  r11 ba09eda8
    ip  00000000  sp  fff61260  lr  e163454c  pc  e1634534

30 total frames
backtrace:
      #00 pc 00326534  /apex/com.android.art/lib/libart.so (nterp_op_invoke_virtual+52) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #01 pc 00876da8  /data/app/~~v5p35KBpWZ0nsdHyyvV0yQ==/com.bletest-7FoSQHRwBdIS8-dMoCMLFg==/oat/arm/base.vdex (it.innove.NativeBleManagerSpec.emitOnDiscoverPeripheral+16)
      #02 pc 0032c500  /apex/com.android.art/lib/libart.so (nterp_helper+2800) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #03 pc 00876546  /data/app/~~v5p35KBpWZ0nsdHyyvV0yQ==/com.bletest-7FoSQHRwBdIS8-dMoCMLFg==/oat/arm/base.vdex (it.innove.DefaultScanManager.onDiscoveredPeripheral+318)
      #04 pc 0032c500  /apex/com.android.art/lib/libart.so (nterp_helper+2800) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #05 pc 008763c4  /data/app/~~v5p35KBpWZ0nsdHyyvV0yQ==/com.bletest-7FoSQHRwBdIS8-dMoCMLFg==/oat/arm/base.vdex (it.innove.DefaultScanManager.-$$Nest$monDiscoveredPeripheral+0)
      #06 pc 0032ba48  /apex/com.android.art/lib/libart.so (nterp_helper+56) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #07 pc 00876234  /data/app/~~v5p35KBpWZ0nsdHyyvV0yQ==/com.bletest-7FoSQHRwBdIS8-dMoCMLFg==/oat/arm/base.vdex (it.innove.DefaultScanManager$2$1.run+12)
      #08 pc 005a2c87  /system/framework/arm/boot-framework.oat (android.os.Handler.dispatchMessage+70) (BuildId: 72d9f3b9c14393f5511d5220f35de6d6627160bb)
      #09 pc 005a5847  /system/framework/arm/boot-framework.oat (android.os.Looper.loopOnce+854) (BuildId: 72d9f3b9c14393f5511d5220f35de6d6627160bb)
      #10 pc 005a547f  /system/framework/arm/boot-framework.oat (android.os.Looper.loop+478) (BuildId: 72d9f3b9c14393f5511d5220f35de6d6627160bb)
      #11 pc 00383c9f  /system/framework/arm/boot-framework.oat (android.app.ActivityThread.main+1542) (BuildId: 72d9f3b9c14393f5511d5220f35de6d6627160bb)
      #12 pc 00143dd5  /apex/com.android.art/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #13 pc 001bc1e1  /apex/com.android.art/lib/libart.so (void art::quick_invoke_reg_setup<true>(art::ArtMethod*, unsigned int*, unsigned int, art::Thread*, art::JValue*, char const*) (.__uniq.192663596067446536341070919852553954320.llvm.17112358095869631794)+112) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #14 pc 001bbd3f  /apex/com.android.art/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+134) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #15 pc 0029e8f1  /apex/com.android.art/lib/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)4>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned int)+1100) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #16 pc 004c433f  /apex/com.android.art/lib/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*) (.__uniq.165753521025965369065708152063621506277)+22) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #17 pc 0009c179  /system/framework/arm/boot.oat (art_jni_trampoline+56) (BuildId: 6baf4648bfc29351da5cc24a455a4e1c5e4a4b5d)
      #18 pc 0088faed  /system/framework/arm/boot-framework.oat (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+116) (BuildId: 72d9f3b9c14393f5511d5220f35de6d6627160bb)
      #19 pc 00898603  /system/framework/arm/boot-framework.oat (com.android.internal.os.ZygoteInit.main+3034) (BuildId: 72d9f3b9c14393f5511d5220f35de6d6627160bb)
      #20 pc 00143dd5  /apex/com.android.art/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #21 pc 001bc1e1  /apex/com.android.art/lib/libart.so (void art::quick_invoke_reg_setup<true>(art::ArtMethod*, unsigned int*, unsigned int, art::Thread*, art::JValue*, char const*) (.__uniq.192663596067446536341070919852553954320.llvm.17112358095869631794)+112) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #22 pc 001bbd3f  /apex/com.android.art/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+134) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #23 pc 001ef055  /apex/com.android.art/lib/libart.so (art::JValue art::InvokeWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)+268) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #24 pc 00106599  /apex/com.android.art/lib/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+24) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #25 pc 004706af  /apex/com.android.art/lib/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+454) (BuildId: d963fb24d06855807a6574ea74a2cf53)
      #26 pc 000899d9  /system/lib/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+20) (BuildId: e953cf0acaa62fa69ffe71cea5372e21)
      #27 pc 0009295d  /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+512) (BuildId: e953cf0acaa62fa69ffe71cea5372e21)
      #28 pc 00002547  /system/bin/app_process32 (main+982) (BuildId: 518f3945cf61e7eeaf79c722821f237c)
      #29 pc 0005bde5  /apex/com.android.runtime/lib/bionic/libc.so (__libc_init+60) (BuildId: ac29b057fca6aa7ac9a9161d7c6d401f)

so the crash was happening in method emitOnDiscoverPeripheral and this method is generated in the Spec file and contains

protected final void emitOnDiscoverPeripheral(ReadableMap value) {
    mEventEmitterCallback.invoke("onDiscoverPeripheral", value);
  }

i was not able to go any further than this in my investigation. i will appreciate any help since i am forced to maintain to different projects so users are able to use our production app, one for android using old RN version with old architecture. and one for IOS using latest RN version new architecture.

Full adb logcat

adb bugreport dumpstate crash 1 will be under FS/data/tombstones/tombstone_00 crash 2 will be under FS/data/tombstones/tombstone_01

i opened an issue also on the library git, and apparently other users are facing the same problem issue

i also tested with RN: 0.78.0-rc.5 same behavior reproducible RN 0.78

Steps to reproduce

1- generate a release apk by cd android && gradlew assembleRelease 2- go to Samsung Remote Test Lab sign in and get your free credits 3- search for device SM-A135F or SM-A137F and choose one from the list. it does not matter which android version or region, the crash happens on all devices in the list 4- upload the release apk to the device and install it 5- launch the app, wait for 40-50 seconds without doing anything and the app will crash on its own 6- click Scan bluetooth and the app will crash whenever it tries to report a scanned device nearby

React Native Version

0.77.1 / 0.78.0-rc.5

Affected Platforms

Runtime - Android

Areas

TurboModule - The New Native Module System

Output of npx @react-native-community/cli info

System:
  OS: Windows 11 10.0.26100
  CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz
  Memory: 5.47 GB / 15.79 GB
Binaries:
  Node:
    version: 22.12.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: C:\Program Files\nodejs\yarn.CMD
  npm:
    version: 10.9.0
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 16.11.33423.256 (Visual Studio Enterprise 2019)
Languages:
  Java: 17.0.12
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.77.1
    wanted: 0.77.1
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

Crashed: Thread: SIGSEGV  0x00000000c0deadc4
#00 pc 0x326534 libart.so (BuildId: d963fb24d06855807a6574ea74a2cf53)
#01 pc 0xba09eda6
#02 pc 0xba09e544
#03 pc 0xba09ed86
#04 pc 0x322dfe libart.so (BuildId: d963fb24d06855807a6574ea74a2cf53)
#05 pc 0xba09e544

Reproducer

https://github.com/barakataboujreich/BleTestRn0.77

Screenshots and Videos

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 44 (25 by maintainers)

Most upvoted comments

I found a way to reproduce this issue easily. It occurs only on 32-bit(armeabi-v7a) app. However, the Android emulator(ARM64 Image) doesn’t support testing 32-bit(armeabi-v7a) apps, so you’ll need any physical device that supports 32-bit(armeabi-v7a).

Steps to reproduce

  1. Check if your device supports 32-bit.
adb shell getprop ro.product.cpu.abilist
# arm64-v8a,armeabi-v7a,armeabi <- Support armeabi-v7a(32-bit)

Android emulator(ARM64 Image) cannot reproduce.

adb shell getprop ro.product.cpu.abilist
# arm64-v8a <- Unsupport armeabi-v7a(32-bit)
  1. Build the app in release mode
cd android
./gradlew assembleRelease
  1. Install the 32-bit version of the app
adb install --abi armeabi-v7a app-release.apk
  1. Open the app → the app crashes

  2. Uninstall the app and install the 64-bit version

adb install --abi arm64-v8a app-release.apk
  1. Open the app → the app works fine

I tested it on Samsung Galaxy S23.

Closing as this has been fully fixed, also the follow-up issue opened here:

Fixed by:

@illestomas due to the nature of this change (it currently contains a breaking change), I suspect it will be harder to backport. We’ll definitely ship it in 0.80

Hello everyone, @cortinico, just wanted to confirm that I was able to fix the issue on 0.77.2 by applying the patch from the linked PR to the native files in the node_modules folder and building from source. Building from source was very easy to setup, it only required:

  • Apply the patch from this PR to the node_modules packages
  • Save the patches with the patch-package package (see it’s doc about installation). If you are getting out-of-buffer errors try to leverage the include/exclude options to limit the fileds on which the diff is made. For example latest patch required npx patch-package react-native --include 'ReactCommon/react/nativemodule/.*\.(h|cpp)$' to include only header and cpp files.
  • Updating the android/settings.gradle file link
  • installing Android SDK command line tools
  • clearing the gradle cache
  • running the codegen

Seems that this could solve our issues till the official 0.80 version is released and all dependencies able to update (e.g. expo).

Hey @kenziy , yes the PR paves the way to fix the issue, but additonal fix is needed. You can check the following issue as continuation of this one:

Thanks for this valuable information @toy0605, this is really gold. I’ve been able to reproduce on a device of mine. I’ll get back to you folks with an update as I’m done investigating

@cortinico @mikehardy that was also my first thought that react-native-ble-manager was causing the issue somehow with invalid handling of the events that is why i opened a ticket first at the library repository.

but i decided to investigate further into the issue and created a simple app with a turbo module with one function that takes two numbers, sums them and return the result through promise and event. on my personal phone and company testing devices the app behave normal and the event is captured successfully.

the A13 on android 12 to 14 the app crashes in 2 behaviors:

  • press compute button, app crashes within 1-3 seconds
  • press compute button, promise is fulfilled, but the event subscribed to does not receive any callback, pressing the home button (app will become in background. my guess GC runs) will crash the app immediately

this is the reproducer for the minimal app with the calculator turbo module

i spent the whole day today to try and replicate the issue on android studio emulator by tweaking the settings, but the app is not crashing no matter what i do. then i tried on browserstack to try and find a pixel device that will crash, but also to no avail.

and while testing on browserstack to my surprise is that i found a new behavior also on samsung devices, the galaxy a10 android 9, galaxy a11 android 10, LG android 8.1, crashes immediately on app start, i do not even need to do any action, emulator with same android version does not crash.

can it be a node version, npm version, java version that is causing the issue?

Unfortunately after more testing another crash appeared with the same event emitting of turbo modules on same 32bit devices

Can we open a separate issue + can we update the reproducer against the latest nightly?

Hello again everyone, @javache @cortinico.

Unfortunately after more testing another crash appeared with the same event emitting of turbo modules on same 32bit devices. The patch that I applied fixed the crash on app startup, however now I’m observing another crash when the event is emitted for first time. The crash is always reproducible only on 32bit devices on signed production builds. I have created reproduction demo, which is basically the official demo code for creating turbo module with event:

Steps to reproduce:

  1. Pull the repo, install the dependencies
  2. Previous patch is applied automatically by patch-package
  3. Run codegen on android
  4. Build signed apk. To create it you will need to create new demo key-store.
  5. Install the build apk in 32bit mode by adb -s YOURDEVICE install --abi armeabi-v7a android/app/release/app-release.apk
  6. Run the app, create key, save it. Than update the key and save it again. The app crashes.

Here is the relevant part of the crash log - you can get the full one using the repro above:

05-27 11:51:02.686  1426  2117 I ActivityManager: Killing 9327:com.android.keychain/1000 (adj 999): empty #21
05-27 11:51:02.687  1426  2117 I ActivityManager: Changes in 10254 5 to 19, 8 to 0
05-27 11:51:02.688  1426  1674 I UMR     : B|Compact com.google.android.googlequicksearchbox:search(18732)
05-27 11:51:02.689 18732 18732 I cmvo    : onStop
05-27 11:51:02.693  1426  1550 I libprocessgroup: Successfully killed process cgroup uid 1000 pid 9327 in 5ms
05-27 11:51:02.703  1426  1674 I UMR     : E|Compact d_rss=1372KB
05-27 11:51:02.709   904   904 I Zygote  : Process 9327 exited due to signal 9 (Killed)
05-27 11:51:02.833 11790 11790 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-27 11:51:02.833 11790 11790 F DEBUG   : Build fingerprint: 'samsung/a32xeea/a32x:13/TP1A.220624.014/A326BXXSDCXJA:user/release-keys'
05-27 11:51:02.833 11790 11790 F DEBUG   : Revision: '7'
05-27 11:51:02.833 11790 11790 F DEBUG   : ABI: 'arm'
05-27 11:51:02.833 11790 11790 F DEBUG   : Processor: '7'
05-27 11:51:02.833 11790 11790 F DEBUG   : Timestamp: 2025-05-27 11:51:02.250465306+0300
05-27 11:51:02.833 11790 11790 F DEBUG   : Process uptime: 1s
05-27 11:51:02.833 11790 11790 F DEBUG   : Cmdline: com.awesomeproject
05-27 11:51:02.833 11790 11790 F DEBUG   : pid: 11740, tid: 11779, name: mqt_v_js  >>> com.awesomeproject <<<
05-27 11:51:02.833 11790 11790 F DEBUG   : uid: 10521
05-27 11:51:02.833 11790 11790 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x00000004
05-27 11:51:02.833 11790 11790 F DEBUG   : Cause: null pointer dereference
05-27 11:51:02.833 11790 11790 F DEBUG   :     r0  b7df5f00  r1  b7df5fa4  r2  00000004  r3  b7df5ff8
05-27 11:51:02.833 11790 11790 F DEBUG   :     r4  00000001  r5  e464cc9c  r6  b7df5f10  r7  00000000
05-27 11:51:02.833 11790 11790 F DEBUG   :     r8  e4001609  r9  b7df5f9c  r10 145fe958  r11 b7df5fa4
05-27 11:51:02.833 11790 11790 F DEBUG   :     ip  00000002  sp  b7df5ee0  lr  e1cca50b  pc  e1cc9a84
05-27 11:51:02.833 11790 11790 F DEBUG   : backtrace:
05-27 11:51:02.833 11790 11790 F DEBUG   :       #00 pc 0052ba84  /apex/com.android.art/lib/libart.so (art::(anonymous namespace)::ArgArray::BuildArgArrayFromVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, art::ObjPtr<art::mirror::Object>, std::__va_list) (.__uniq.245181933781456475607640333933569312899)+164) (BuildId: bbc8525991a1fb6be508c71defdd34d8)
05-27 11:51:02.833 11790 11790 F DEBUG   :       #01 pc 0052c507  /apex/com.android.art/lib/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+386) (BuildId: bbc8525991a1fb6be508c71defdd34d8)
05-27 11:51:02.834 11790 11790 F DEBUG   :       #02 pc 003ded8d  /apex/com.android.art/lib/libart.so (art::JNI<false>::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+444) (BuildId: bbc8525991a1fb6be508c71defdd34d8)
05-27 11:51:02.834 11790 11790 F DEBUG   :       #03 pc 00261129  /data/app/~~Rsv22hk04KoUaJ1tmZphlg==/com.awesomeproject-W_5OFIiJQo4tJbFAusGdfA==/base.apk!libreactnative.so (BuildId: aab956e17a170a7f)
05-27 11:51:02.834 11790 11790 F DEBUG   :       #04 pc 00333923  /data/app/~~Rsv22hk04KoUaJ1tmZphlg==/com.awesomeproject-W_5OFIiJQo4tJbFAusGdfA==/base.apk!libreactnative.so (facebook::react::JavaTurboModule::setEventEmitterCallback(facebook::jni::alias_ref<_jobject*>)+338) (BuildId: aab956e17a170a7f)
05-27 11:51:02.834 11790 11790 F DEBUG   :       #05 pc 0000b545  /data/app/~~Rsv22hk04KoUaJ1tmZphlg==/com.awesomeproject-W_5OFIiJQo4tJbFAusGdfA==/base.apk!libappmodules.so (facebook::react::NativeLocalStorageSpecJSI::NativeLocalStorageSpecJSI(facebook::react::JavaTurboModule::InitParams const&)+568) (BuildId: 1845c84c5d9dc31b8d30e3074a8418d7c586f3c5)
05-27 11:51:02.834 11790 11790 F DEBUG   :       #06 pc 0000ba05  /data/app/~~Rsv22hk04KoUaJ1tmZphlg==/com.awesomeproject-W_5OFIiJQo4tJbFAusGdfA==/base.apk!libappmodules.so (facebook::react::NativeLocalStorageSpec_ModuleProvider(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, facebook::react::JavaTurboModule::InitParams const&)+84) (BuildId: 1845c84c5d9dc31b8d30e3074a8418d7c586f3c5)
05-27 11:51:02.834 11790 11790 F DEBUG   :       #07 pc 0000fa03  /data/app/~~Rsv22hk04KoUaJ1tmZphlg==/com.awesomeproject-W_5OFIiJQo4tJbFAusGdfA==/base.apk!libappmodules.so (facebook::react::javaModuleProvider(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, facebook::react::JavaTurboModule::InitParams const&)+30) (BuildId: 1845c84c5d9dc31b8d30e3074a8418d7c586f3c5)
05-27 11:51:02.834 11790 11790 F DEBUG   : 

Hey @cortinico, we are hitting this issue as well in production, however the upgrade to 0.80 at this stage is unrealistic as it still on RC, with breaking changes like higher Kotlin version and no Expo support in the upcoming months. Is there any chance to consider again back-port this fix at least to 0.79 (or better 0.77)? We are seeing like 10% of our user base using 32bit phones, which is practically making the current RN versions unusable for production with the new arch enabled.

Also can confirm this happens only on armeabi-v7a (arm32).

Unfortunately @fm1randa reproduction with firebase or google mobile ads will never be too helpful for people as they require a lot of external accounts to be provisioned and configured.

I believe that we already have a reproducer courtesy of @barakataboujreich so the real next steps here are - hopefully 🤞 - for someone with experience hacking on the react-native new arch code and a device that reproduces it to have some time to give it a shot to verify local reproduction, and then ideally (again 🤞 ) to be able to fix it

I’m asking @gabrieldonadel and other folks at Expo if they can help us with reproducing this bug

@cortinico i reported this issue to the library, and is linked to this issue also, we did a workaround for now to be able to release the apps to the store.

But i do not think this is a library issue anymore, there is something wrong and i can’t figure it out. i removed react-native-ble-manager, and followed this tutorial to add a turbo module and applied what was suggested here to add Event emission and installed the app through yarn run android --mode=release

the A13 on test lab kept crashing you can watch it here

a Motorola testing device and my personal phone does not crash you can watch it here

this is the basic code that i wrote. i do not know what to provide you more to be able to find out why the crash is happening

App.tsx

import React, {JSX} from "react";
import { useState } from "react";
import { Alert, EventSubscription, SafeAreaView, StatusBar, Text, Button } from "react-native";
import NativeCalculator from "./specs/NativeCalculator";

const App: () => JSX.Element = () => {
  const [result, setResult] = useState<number | null>(null);
  const listenerSubscription = React.useRef<null | EventSubscription>(null);

  React.useEffect(() => {
    listenerSubscription.current = NativeCalculator.onValueChanged((data) => { Alert.alert(`Result: ${data}`) });

    return  () => {
      listenerSubscription.current?.remove();
      listenerSubscription.current = null;
    }
  }, [])
  return (
    <SafeAreaView>
      <StatusBar barStyle={"dark-content"} />
      <Text style={{ marginLeft: 20, marginTop: 20 }}>
        3+7={result ?? "??"}
      </Text>
      <Button
        title="Compute"
        onPress={async () => {
          const value = await NativeCalculator.add(3, 7);
          setResult(value ?? null);
        }}
      />
    </SafeAreaView>
  );
};
export default App;

specs/NativeCalculator.ts

import type {TurboModule} from 'react-native';
import {TurboModuleRegistry} from 'react-native';
import type {EventEmitter} from 'react-native/Libraries/Types/CodegenTypes';

export interface Spec extends TurboModule {
    add(a: number, b: number): Promise<number>;
    readonly onValueChanged: EventEmitter<number>
}

export default TurboModuleRegistry.getEnforcing<Spec>(
  'NativeCalculator',
);

android\app\src\main\java\com\nativecalculator\NativeCalculatorModule.java

package com.nativecalculator;

import android.content.Context;
import android.content.SharedPreferences;

import com.facebook.react.bridge.Promise;
import com.nativecalculator.NativeCalculatorSpec;
import com.facebook.react.bridge.ReactApplicationContext;

public class NativeCalculatorModule extends NativeCalculatorSpec {

    public static final String NAME = "NativeCalculator";

    public NativeCalculatorModule(ReactApplicationContext reactContext) {
        super(reactContext);
    }

    @Override
    public String getName() {
        return NAME;
    }

    @Override
    public void add(double a, double b, Promise promise) {
        promise.resolve(a + b);
        emitOnValueChanged(a + b);
    }
}

android\app\src\main\java\com\nativecalculator\NativeCalculatorPackage.java

package com.nativecalculator;

import com.facebook.react.BaseReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.module.model.ReactModuleInfo;
import com.facebook.react.module.model.ReactModuleInfoProvider;

import java.util.HashMap;
import java.util.Map;

public class NativeCalculatorPackage extends BaseReactPackage {

  @Override
  public NativeModule getModule(String name, ReactApplicationContext reactContext) {
    if (name.equals(NativeCalculatorModule.NAME)) {
      return new NativeCalculatorModule(reactContext);
    } else {
      return null;
    }
  }

  @Override
  public ReactModuleInfoProvider getReactModuleInfoProvider() {
    return new ReactModuleInfoProvider() {
      @Override
      public Map<String, ReactModuleInfo> getReactModuleInfos() {
        Map<String, ReactModuleInfo> map = new HashMap<>();
        map.put(NativeCalculatorModule.NAME, new ReactModuleInfo(
          NativeCalculatorModule.NAME,       // name
          NativeCalculatorModule.NAME,       // className
          false, // canOverrideExistingModule
          false, // needsEagerInit
          false, // isCXXModule
          true   // isTurboModule
        ));
        return map;
      }
    };
  }
}

package.json

{
  "name": "BleTest",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "codegenConfig": {
    "name": "NativeCalculatorSpec",
    "type": "modules",
    "jsSrcsDir": "specs",
    "android": {
      "javaPackageName": "com.nativecalculator"
    }
  },
  "dependencies": {
    "@react-native-firebase/app": "^21.11.0",
    "@react-native-firebase/crashlytics": "^21.11.0",
    "react": "19.0.0",
    "react-native": "0.78.1"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@babel/preset-env": "^7.25.3",
    "@babel/runtime": "^7.25.0",
    "@react-native-community/cli": "15.0.1",
    "@react-native-community/cli-platform-android": "15.0.1",
    "@react-native-community/cli-platform-ios": "15.0.1",
    "@react-native/babel-preset": "0.78.1",
    "@react-native/eslint-config": "0.78.1",
    "@react-native/metro-config": "0.78.1",
    "@react-native/typescript-config": "0.78.1",
    "@types/jest": "^29.5.13",
    "@types/react": "^19.0.0",
    "@types/react-test-renderer": "^19.0.0",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "19.0.0",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  }
}

crash log

	DEBUG		***
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		Build fingerprint: 'samsung/a13ks/a13:13/TP1A.220624.014/A135NKSS5CWK1:user/release-keys'
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		Revision: '6'
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		ABI: 'arm'
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		Processor: '7'
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		Timestamp: 2025-03-28 00:50:14.039803377+0900
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		Process uptime: 6s
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		Cmdline: com.bletest
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		pid: 32502, tid: 32564, name: mqt_v_native  >>> com.bletest <<<
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		uid: 10254
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x71605a68
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		r0  6f8b11a8  r1  13337440  r2  00000001  r3  0000000c
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		r4  ba2b36c0  r5  ba2b36b8  r6  ba2b36b0  r7  0000106e
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		r8  00000000  r9  e6268a00  r10 e44ec880  r11 e3f67cd0
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		ip  20000000  sp  ba2b36a0  lr  e44f6038  pc  71605a68
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		backtrace:
2025-03-28	00:50:14.772	32672	32672	F		DEBUG		#00 pc 00132a68  [anon:dalvik-zygote space]
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#01 pc 000ee034  /apex/com.android.art/lib/libart.so (nterp_helper+2980) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#02 pc 000f5cd0  /apex/com.android.art/javalib/core-oj.jar (java.lang.Thread.countStackFrames+0)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#03 pc 000edf80  /apex/com.android.art/lib/libart.so (nterp_helper+2800) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#04 pc 0047752c  /data/app/~~y7qv6zOqPzV1IoiGCuOupg==/com.bletest-KoDo3zH1O-LfYntaaMLrwQ==/oat/arm/base.vdex (com.nativecalculator.NativeCalculatorSpec.emitOnValueChanged+24)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#05 pc 000edf80  /apex/com.android.art/lib/libart.so (nterp_helper+2800) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#06 pc 00477408  /data/app/~~y7qv6zOqPzV1IoiGCuOupg==/com.bletest-KoDo3zH1O-LfYntaaMLrwQ==/oat/arm/base.vdex (com.nativecalculator.NativeCalculatorModule.add+16)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#07 pc 003bdbd5  /apex/com.android.art/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#08 pc 003bd677  /apex/com.android.art/lib/libart.so (void art::quick_invoke_reg_setup<false>(art::ArtMethod*, unsigned int*, unsigned int, art::Thread*, art::JValue*, char const*) (.__uniq.192663596067446536341070919852553954320.llvm.16200230356545185596)+158) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#09 pc 00288f1d  /apex/com.android.art/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+136) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#10 pc 003128a9  /apex/com.android.art/lib/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*) (.__uniq.245181933781456475607640333933569312899.llvm.1951482298021755071)+40) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#11 pc 003127b5  /apex/com.android.art/lib/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+164) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#12 pc 0033dc8b  /apex/com.android.art/lib/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+42) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#13 pc 0045fa45  /apex/com.android.art/lib/libart.so (art::JNI<false>::CallVoidMethodA(_JNIEnv*, _jobject*, _jmethodID*, jvalue const*)+84) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#14 pc 0031e8fd  /data/app/~~y7qv6zOqPzV1IoiGCuOupg==/com.bletest-KoDo3zH1O-LfYntaaMLrwQ==/base.apk!libreactnative.so (BuildId: ed48fa53d517301d)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#15 pc 00397f45  /data/app/~~y7qv6zOqPzV1IoiGCuOupg==/com.bletest-KoDo3zH1O-LfYntaaMLrwQ==/base.apk!libreactnative.so (BuildId: ed48fa53d517301d)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#16 pc 000106a3  /data/app/~~y7qv6zOqPzV1IoiGCuOupg==/com.bletest-KoDo3zH1O-LfYntaaMLrwQ==/base.apk!libfbjni.so (facebook::jni::detail::MethodWrapper<void (facebook::jni::JNativeRunnable::*)(), &(facebook::jni::JNativeRunnable::run()), facebook::jni::JNativeRunnable, void>::dispatch(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::jni::JNativeRunnable, facebook::jni::JRunnable>::JavaPart, facebook::jni::JRunnable, void>::_javaobject*>)+54) (BuildId: bc1f23c0c45e1c7ad496193c948e61d7f39b15e9)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#17 pc 0001061d  /data/app/~~y7qv6zOqPzV1IoiGCuOupg==/com.bletest-KoDo3zH1O-LfYntaaMLrwQ==/base.apk!libfbjni.so (facebook::jni::detail::FunctionWrapper<void (*)(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::jni::JNativeRunnable, facebook::jni::JRunnable>::JavaPart, facebook::jni::JRunnable, void>::_javaobject*>), facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::jni::JNativeRunnable, facebook::jni::JRunnable>::JavaPart, facebook::jni::JRunnable, void>::_javaobject*, void>::call(_JNIEnv*, _jobject*, void (*)(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::jni::JNativeRunnable, facebook::jni::JRunnable>::JavaPart, facebook::jni::JRunnable, void>::_javaobject*>))+32) (BuildId: bc1f23c0c45e1c7ad496193c948e61d7f39b15e9)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#18 pc 0002abc5  /data/app/~~y7qv6zOqPzV1IoiGCuOupg==/com.bletest-KoDo3zH1O-LfYntaaMLrwQ==/oat/arm/base.odex (art_jni_trampoline+68)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#19 pc 004d3093  /system/framework/arm/boot-framework.oat (android.os.Handler.dispatchMessage+74) (BuildId: 14300ad3095f9cc733ab5653af305b42677ec5ae)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#20 pc 000edfec  /apex/com.android.art/lib/libart.so (nterp_helper+2908) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#21 pc 0033327c  /data/app/~~y7qv6zOqPzV1IoiGCuOupg==/com.bletest-KoDo3zH1O-LfYntaaMLrwQ==/oat/arm/base.vdex (com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage+0)
2025-03-28	00:50:14.773	32672	32672	F		DEBUG		#22 pc 004d588f  /system/framework/arm/boot-framework.oat (android.os.Looper.loopOnce+894) (BuildId: 14300ad3095f9cc733ab5653af305b42677ec5ae)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#23 pc 004d5499  /system/framework/arm/boot-framework.oat (android.os.Looper.loop+488) (BuildId: 14300ad3095f9cc733ab5653af305b42677ec5ae)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#24 pc 000ed53c  /apex/com.android.art/lib/libart.so (nterp_helper+172) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#25 pc 00333822  /data/app/~~y7qv6zOqPzV1IoiGCuOupg==/com.bletest-KoDo3zH1O-LfYntaaMLrwQ==/oat/arm/base.vdex (com.facebook.react.bridge.queue.MessageQueueThreadImpl.lambda$startNewBackgroundThread$2+70)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#26 pc 000ed53c  /apex/com.android.art/lib/libart.so (nterp_helper+172) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#27 pc 00333314  /data/app/~~y7qv6zOqPzV1IoiGCuOupg==/com.bletest-KoDo3zH1O-LfYntaaMLrwQ==/oat/arm/base.vdex (com.facebook.react.bridge.queue.MessageQueueThreadImpl$$ExternalSyntheticLambda1.run+4)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#28 pc 0014ba0f  /system/framework/arm/boot.oat (java.lang.Thread.run+70) (BuildId: bd7c4a5c0fb25656f024e500f6905e89ccd8cf60)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#29 pc 003bdbd5  /apex/com.android.art/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#30 pc 003bd677  /apex/com.android.art/lib/libart.so (void art::quick_invoke_reg_setup<false>(art::ArtMethod*, unsigned int*, unsigned int, art::Thread*, art::JValue*, char const*) (.__uniq.192663596067446536341070919852553954320.llvm.16200230356545185596)+158) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#31 pc 00288f1d  /apex/com.android.art/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+136) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#32 pc 003128a9  /apex/com.android.art/lib/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*) (.__uniq.245181933781456475607640333933569312899.llvm.1951482298021755071)+40) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#33 pc 003127b5  /apex/com.android.art/lib/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+164) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#34 pc 0033dc8b  /apex/com.android.art/lib/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+42) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#35 pc 002f0bad  /apex/com.android.art/lib/libart.so (art::Thread::CreateCallback(void*)+424) (BuildId: 72acbd633b92a2d8c94a7758a3f31f4a)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#36 pc 000ade0b  /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) (BuildId: ab9eb3f965a77a04086244c6ba4e1c11)
2025-03-28	00:50:14.774	32672	32672	F		DEBUG		#37 pc 00063e73  /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) (BuildId: ab9eb3f965a77a04086244c6ba4e1c11)