-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
JNI DETECTED ERROR IN APPLICATION: JNI GetObjectRefType called with pending exception java.lang.RuntimeException: java.lang.AssertionError: Illegal type provided #2722
Comments
Issue validatorThe issue is valid! |
Hey, could you provide a repo to reproduce your issue? Without repro, I am not able to help 😕 |
@piaskowyk Are you saying it's completely stable when you test? |
@piaskowyk @tapz |
@Lukkub In my case only the debug build crashes after I modify some file after app start. I guess that has something to do with Hermes and how RN updates the changed files. Release builds have never crashes with this error. I have never got the 2.3.x to work in iOS. I had to create a separate implementation using the old gesture handler api and RN animations. Can't event import reanimated to an iOS app without it crashing with |
Hey @piaskowyk: I finally tried updating to Managed to create one here: #2256 (comment) Anyways, the crash seems to be back after updating to RN 0.67-rc.6 + Reanimated 2.3.1 and forcing Hermes to version java_vm_ext.cc:579] JNI DETECTED ERROR IN APPLICATION: JNI GetObjectRefType called with pending exception java.lang.RuntimeException: java.lang.AssertionError: Illegal type provided java_vm_ext.cc:579] at void com.swmansion.reanimated.AndroidErrorHandler.raise(java.lang.String) (AndroidErrorHandler.java:6) java_vm_ext.cc:579] at void com.swmansion.reanimated.Scheduler.triggerUI() (Scheduler.java:-2) java_vm_ext.cc:579] at void com.swmansion.reanimated.Scheduler$1.run() (Scheduler.java:24) java_vm_ext.cc:579] at void com.swmansion.reanimated.Scheduler$2.runGuarded() (Scheduler.java:43) java_vm_ext.cc:579] at void com.facebook.react.bridge.GuardedRunnable.run() (GuardedRunnable.java:31) java_vm_ext.cc:579] at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:938) java_vm_ext.cc:579] at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:99) java_vm_ext.cc:579] at boolean android.os.Looper.loopOnce(android.os.Looper, long, int) (Looper.java:201) java_vm_ext.cc:579] at void android.os.Looper.loop() (Looper.java:288) java_vm_ext.cc:579] at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7798) java_vm_ext.cc:579] at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2) java_vm_ext.cc:579] at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:548) java_vm_ext.cc:579] at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1003) java_vm_ext.cc:579] java_vm_ext.cc:579] in call to GetObjectRefType java_vm_ext.cc:579] from void com.swmansion.reanimated.Scheduler.triggerUI() Were you not able to reproduce the problem with the above repro? |
@tapz what changes u did?? I am facing a same issue.. release build never crashed with this error but while testing the app on physical device its get crashed.and fortunately its working fine on ios..dont know whats wrong with android.can u please tell me what changes u did in files?? Your help will be really appreciated.Thanks |
Hi @priyanka17-maker @andreialecu @tapz I would like to share with you my solution for my case. PROBLEM REASON HACK FIX for a problem Effect looks like that:
Then applying style objects looks like that:
I hope this will help you somehow - and maybe it will help to detect the real reason for this crash on Android. |
@Lukkub I haven't changed anything. It has always crashed only in debug builds after the first reload. And in iOS, it has never worker in the debug or the release build (but the reason and error is different than in Android). Here is an example that works perfectly in Android, but not at all in iOS: |
These were exactly my findings here: #2256 (comment) I also found out that if you add a small delay the crash doesn't occur. I'm not sure why @piaskowyk has been ignoring my repro 😆 |
@Lukkub I confirm this workaround works in my case |
@Lukkub yeap, can confirm this too. Spent several hours till got to affected useAnimatedStyle and this workaround... 2.3.x is so buggy actually compared to 2.2.x |
## Description Sometimes RN passes ReadableMap/Array instead of WritableMap/Array when updateProps is called. Currently adding a ReadableMap/Array to a WritableMap/Array is not supported (I opened a PR to allow it since there's no reason it can't be allowed facebook/react-native#32910). In the meantime we have to check if it's not Writable and copy before adding it. Fixes #2722 ## Changes ## Screenshots / GIFs N/A ## Test code and steps to reproduce I'm not sure exactly what the minimum repro is, I could 100% repro the crash in an app, but wasn't able to isolate. The app makes heavy usage of a bottom sheet lib that uses reanimated. I was able to repro a few times in the example app with the repro in the linked issue, but not consistently. In the app where I could repro consistently I verified that it no longer crashes after this change. ## Checklist - [ ] Included code example that can be used to test this change - [ ] Updated TS types - [ ] Added TS types tests - [ ] Added unit / integration tests - [ ] Updated documentation - [ ] Ensured that CI passes
## Description Sometimes RN passes ReadableMap/Array instead of WritableMap/Array when updateProps is called. Currently adding a ReadableMap/Array to a WritableMap/Array is not supported (I opened a PR to allow it since there's no reason it can't be allowed facebook/react-native#32910). In the meantime we have to check if it's not Writable and copy before adding it. Fixes software-mansion#2722 ## Changes ## Screenshots / GIFs N/A ## Test code and steps to reproduce I'm not sure exactly what the minimum repro is, I could 100% repro the crash in an app, but wasn't able to isolate. The app makes heavy usage of a bottom sheet lib that uses reanimated. I was able to repro a few times in the example app with the repro in the linked issue, but not consistently. In the app where I could repro consistently I verified that it no longer crashes after this change. ## Checklist - [ ] Included code example that can be used to test this change - [ ] Updated TS types - [ ] Added TS types tests - [ ] Added unit / integration tests - [ ] Updated documentation - [ ] Ensured that CI passes
Description
The worklets in Reanimated v2 seems to be really unstable in Android. Every change in the worklet code crashes the app and the app needs to be restarted like 5 times (crashes 5 times). And if you have an error in the worklet (e.g. calling any standard javascript function like parseInt, Math.round etc) it crashes in the native code with always the same error.
If I move the code from onEnd worklet to a normal function and call it with runOnJS it either does nothing or the app crashes. Is runOnJS even supposed to work?
Expected behavior
Crashes would be captured and a stack trace printed to the console. Or a proper error in the native logs. And when restarting the app after fixing the code (or not changing it at all when no bug in the code) the app would work in immediately not after 5 to 10 restarts (some caching issue?).
Actual behavior & steps to reproduce
Unhandled crashes and no proper recovery.
Snack or minimal code example
I'm using the pan gesture handler worklets with Samsung Galaxy A51 5G (SM-A516B).
Package versions
Affected platforms
The text was updated successfully, but these errors were encountered: