Skip to content

JNI DETECTED ERROR IN APPLICATION: JNI GetObjectRefType called with pending exception java.lang.RuntimeException: java.lang.AssertionError: Illegal type provided #2722

@tapz

Description

@tapz

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?

 java_vm_ext.cc:578] JNI DETECTED ERROR IN APPLICATION: JNI GetObjectRefType called with pending exception java.lang.RuntimeException: java.lang.AssertionError: Illegal type provided
 java_vm_ext.cc:578]   at void com.swmansion.reanimated.AndroidErrorHandler.raise(java.lang.String) (AndroidErrorHandler.java:6)
 java_vm_ext.cc:578]   at void com.swmansion.reanimated.Scheduler.triggerUI() (Scheduler.java:-2)
 java_vm_ext.cc:578]   at void com.swmansion.reanimated.Scheduler$1.run() (Scheduler.java:24)

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

  • React Native: 0.66.3
  • React Native Reanimated: 2.3.0
  • React Native Gesture Handler: 2.1.0
  • NodeJS: 14.18.1
  • Java & Gradle: OpenJDK 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing) & 7.3

Affected platforms

  • Android
  • iOS
  • Web

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions