Closed efstathiosntonas closed 6 months ago
Hey @efstathiosntonas, I appreciate your report.
Although you haven't provided reproducible steps and the error is both cryptic and nonsensical, I actually have one idea why it may happen. I will address it in the next release (this week) with a potential fix.
Thanks for looking into this Jacek. Truth is I cannot reproduce it, I'm not doing anything fancy in unistyles setup and it's working as a charm.
It happened only in 1 Android device/user among thousands of them in a timespan of 1 month.
I see. I also didn't encounter any errors in Sentry. I hope version 2.4.0 will resolve this. I will keep the issue open until the next release.
Today the crashes counter increased to 4, not that it will help much but the error changed slightly:
java.lang.UnsatisfiedLinkError: No implementation found for void com.unistyles.UnistylesModule.nativeOnOrientationChange(int, int) (tried Java_com_unistyles_UnistylesModule_nativeOnOrientationChange and Java_com_unistyles_UnistylesModule_nativeOnOrientationChange__II)
at com.unistyles.UnistylesModule.nativeOnOrientationChange(UnistylesModule.kt:-2)
at com.unistyles.UnistylesModule.onConfigChange$lambda$0(UnistylesModule.kt:51)
at com.unistyles.UnistylesModule.$r8$lambda$Y5cS3iwg3AGCEcfvPfDYHsquXR0(Unknown)
at com.unistyles.UnistylesModule$$ExternalSyntheticLambda0.run(Unknown:4)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:223)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:234)
at java.lang.Thread.run(Thread.java:923)
I already have a fix on the branch π
@jpudysz hi, sorry for asking but is there an eta for this fix? I'm about to ship an update π
Yeah, sorry I had to fully test Android. I will be able to ship this evening / tomorrow morning CET time as I'm almost ready
perfect, thanks @jpudysz, keep it up!
Thanks @efstathiosntonas for being patient, this release will be huge!
yeah, one more reason to ask before shipping the update haha!
I've just released v2.4.0-rc.2. Mobile/Web/SSR/macOS are tested and implemented there. I just need to align windows code. You can give it a try.
Released #149
@efstathiosntonas any update about the crashes?
@jpudysz hi, all good on 2.4.0, let's close this! Thank you β€οΈ
I'm able to reproduce it with latest version 2.9.0 It happens after interacting with TextInput and goBack in react navigation
UnsatisfiedLinkError: No implementation found for void com.unistyles.UnistylesModule.nativeOnOrientationChange(com.unistyles.Screen, com.unistyles.Insets, com.unistyles.Dimensions, com.unistyles.Dimensions) (tried Java_com_unistyles_UnistylesModule_nativeOnOrientationChange and Java_com_unistyles_UnistylesModule_nativeOnOrientationChange__Lcom_unistyles_Screen_2Lcom_unistyles_Insets_2Lcom_unistyles_Dimensions_2Lcom_unistyles_Dimensions_2) - is the library loaded, e.g. System.loadLibrary?
Is this Android with ProGuard ?
ProGuard is disabled, in debug buildType, Android 34 (Pixel 7) - Emulator
react-native: 0.74.3
react-native-unistyles: 2.9.0
"@react-navigation/native": "^6.1.18",
"@react-navigation/native-stack": "^6.11.0"
UPD
It seems it's not related to react-navigation directly It happens when I close the keyboard
I will try to make a reproducible app tomorrow
Can you build a small repro?
@jpudysz We found what was the problem To give some context
We had to initialise unistyles in the App as well otherwise it was crashing on Android on keyboard hide
Got it, thanks for letting me know ππΌ
@jpudysz I can't build a small repro but I could reproduce the issue. I'm using Android Native + React Native with Unistyles for some screens, also I am just setting up Unistyles as the doc says.
1 - Have a theme file 2 - Have an unistyles file at root level 3 - Import unistyles on App.
My Android App doesn't have any other orientation so I force portrait mode for all activities, including React Native Activity, by adding this property on the manifest:
android:screenOrientation="portrait"
What I did to reproduce the issue was: 1 - Open a React Native screen that contains an input text that opens a keyboard; 2 - Open the Keyboard; 3 - Close the keyboard by pressing on the button to close it or just loosing focus of the input text (Crash).
My release .apk has -keep class com.unistyles.** { *; }
on the proguard-rules.pro
file so I don't know how can I solve it.
"react-native-unistyles": "^2.9.1",
"react": "18.2.0",
"react-native": "0.74.5",
If you give me more time I can try to recreate a close scenario to what i have here...
I'm happy to help, but I can't afford to spend a few hours looking for the problem. A repro is needed. I use Unistyles every day in several projects and have never encountered this issue (also, I'm not using ProGuard).
@jpudysz Thanks for the quick reply!!
I could find the issue and despite me being the issue as well, I had one small entry point registered for the screen that is crashing (I don't share all screens on a single app registry).
That entry point didn't have the import for unistyles even though I am not using it on any of that screens (they are legacy and use styled-components). By adding the import on that entry point the crash was fixed π
That's why repros are critical π I'm happy that you've found the root cause!
Description
It only appeared once in a huge user base and it happened on
MainActivity#onResume()
on Android 13 Samsung S20 FE 5G:Steps to reproduce
Snack or a link to a repository (optional)
No response
Unistyles version
2.3.0
React Native version
0.73.4
Platforms
Android
Engine
Hermes
Architecture
Paper (old)