-
Notifications
You must be signed in to change notification settings - Fork 24.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App crashes on android only with signed apk on specific devices #49510
Comments
Have you tried to report the issue to the library first? I really appreciate you sharing reproducer + steps to reproduce, but it's unlikely we'll be able to fix this. Also from the native stacktrace there are no mention of React Native at all. |
i also opened an issue in the library git. the stacktrace from firebase is useless. i only got to my conclusion from the tombstones which i attached. i didn't put it as raw data since it is 4k+ lines...
here it clearly states that in the NativeBleManagerSpec the crash happened. which is autogenerated by codegen, and this is the function
|
Can you link it here? |
@cortinico did you have time to check the linked issue? we are still experiencing the crashes on samsung A13 |
Nope sorry I don't have that device and I can't really replicate this. Also is this a |
are there any suggestions to further debug this issue at least so we can move further? and 90% of the crashes on A13 were solved. now we are receiving new crashes immediately on app launch. this is the latest stacktrace from A13 5G running android 13. any help is very appreciated.
|
@barakataboujreich have you reported this issue to the library? |
@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 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
specs/NativeCalculator.ts
android\app\src\main\java\com\nativecalculator\NativeCalculatorModule.java
android\app\src\main\java\com\nativecalculator\NativeCalculatorPackage.java
package.json
crash log
|
@barakataboujreich did you link your reproduction? There is also a reproducer template that you can start with that helps a lot when asking core team to troubleshoot something --> https://github.com/react-native-community/reproducer-react-native/ Highly recommend doing the "Use this template" button thing there to clone it out, then apply your minimal changes to add a TurboModule and EventEmitter, and ideally make it so just hitting a single button on the app will make it crash (on Android Go I guess?) |
@mikehardy i created a reproducer with "Use this template" button. i was not able to test on android Go since i do not have a real device and there is no official image from google to create an emulator with android go... i was able to test on samsung a13 real device and on samsung test lab search for SM-A135N-KR1 run the app with default behavior on samsung s22 ultra: behavior 1 on samsung a13: behavior 2 on samsung a13: if running the debug apk the app will not crash and the Alert will be visible |
Thanks for sharing this @barakataboujreich
Just to set expectations, I won't be able to test it on A13 (as I don't have it) and I can't sign up for the cloud testing service. Unless we manage to reproduce it on a emulator or on a Pixel device, there is nothing much we can do here sadly |
@cortinico strange that accessing the Samsung test lab is a barrier - Meta policy against something in their T&Cs ? That isn't really important if it's an impasse though I guess @barakataboujreich perhaps you can try to tease apart what the differences between a release and debug build are to identify what about the release build crashes while the debug build doesn't. Have you tried disabling minification / proguard in the build.gradle file? Is it possible to disable library strip in build.gradle (e.g. https://stackoverflow.com/a/42269046). Both of those steps may yield no change, but the general idea of converging from release to debug until it affects the crash behavior might be a useful way to find the problem |
@mikehardy as i am not an android developer, i know my way around android studio as for sample apps, but i do not have any experience with building a native production app, i tried with the help of AI i set enableProguardInReleaseBuilds in build.gradle to true, and i tried to disable minifying any facebook library in proguard-rules.pro but to no avail, the app kept crashing. i will try and keep researching maybe i will find the issue and the difference between release and debug app, and maybe to replicate the issue on an emulator by tweaking around in the settings, as this is not a minor issue we were receiving crash reports in the hundreds per day and not only the A13 but A13 5G, A03 Core, A11, Moto G Pure, Lenovo Tab M8 and then we pulled the plug and reverted back to old rn version with old architecture enabled for now we found a way to use the old event emitters in turbo module (i guess they are kept for backward compatibility, i do not know when they will become deprecated in the future) and remove any reference to the new event emitters from the spec.tsx file and the app does not crash and behave as normal, but i am not super comfortable releasing the app with such changes as it's like a pandora box |
Hi guys. I reproduced the issue using either Xiaomi POCO C61 (real device) and Samsung A13 (via Samsung test lab). While crashing on these two devices, the release version of my react-native app worked fine and did not crash on Samsung Galaxy A52, Galaxy M32, OnePlus 9, Xiaomi Redmi Note 8 Pro. My app includes Unfortunately, I don't have deep android / @cortinico, it's so sad to hear that you cannot sign up at Samsung test lab. |
Correct. I still don't fully understand if the issue is happening on a empty app on Samsung A13 or if it's specific to If the problem is the former it looks serious, and I can look into an alternative to continue the investigation |
@cortinico my take was that this is serious - that is, react-native-ble-manager triggered it - yes - but then @barakataboujreich did the hard work to reproduce with nothing but a minimal TurboModule that does nothing more than emit an event, and it triggers it as well. The implication is that on ... low-resource phones? ... any TurboModule in New Architecture on Android can crash any time it emits an event. That seems serious |
@cortinico @mikehardy that was also my first thought that 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:
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? |
Thanks for the context. Yes this is worthy more investigation given it happens on a simple module. @barakataboujreich what's the crash log? Could you get the full |
@cortinico i uploaded 2 files for the two different behaviors. i am sorry they are 10k+ lines, test lab is writing too much logs but i tried to analyze as much as i can the files and i will try to point to the crash log in every file crash start at line 8290
crash log at line 8694
- behavior press compute button, app crashes within 1-3 seconds crash start at line 2663
crash log at line 2852
for the browserstack devices, i am on the free tier i only get 1 minute i was not able to pull the logs. tomorrow at the office i will try the LG device on android 8.1 and pull the adb logs from it |
@cortinico this is the crash report from a testing device LG running on android 8.1. The app on it does not even start, it crashes on startup crash start at line 16023
i hope the logs provided could lead you to a conclusion to what is happening. |
I'm experiencing the same issue. However, I'm developing a commercial app, so it's difficult for me to share logs or source code. I'm sorry. I’d like to share a temporary workaround in case it helps someone working with Android native code (e.g., library developers). It's working well for now. So I believe the issue is definitely caused by the |
I'm asking @gabrieldonadel and other folks at Expo if they can help us with reproducing this bug |
I'm experiencing this same issue but with I've been able to reproduce the error consistently on an LG K41S (LM-K4110BMW) device, and I've also seen crash reports in Play Console for a Moto G 5S Plus device. From my tombstone backtrace, I can confirm this is related to the event emitter callback in the Google Mobile Ads TurboModule:
|
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 found a way to reproduce this issue easily. Steps to reproduce
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)
cd android
./gradlew assembleRelease
adb install --abi armeabi-v7a app-release.apk
adb install --abi arm64-v8a app-release.apk
I tested it on Samsung Galaxy S23. |
Thanks for this valuable information @toy0605, this is really gold. |
For context for everyone: this is the symbolicated stacktrace:
The crash specifically is happening here: Line 1000 in 752086c
|
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 crashesfirst 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:
so i investigated further with adb logcat and i was able to find where the crash was happening. Minified version of logcat:
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 containedso the crash was happening in method emitOnDiscoverPeripheral and this method is generated in the Spec file and contains
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
Stacktrace or Logs
Reproducer
https://github.com/barakataboujreich/BleTestRn0.77
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: