software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
9.06k stars 1.31k forks source link

java.lang.NoSuchMethodError: no non-static method "Ljava/lang/Class;.getUpTime()Ljava/lang/String;" #3079

Closed kristfal closed 1 year ago

kristfal commented 2 years ago

Description

Seeing the following crash in production:

java.lang.NoSuchMethodError: no non-static method "Ljava/lang/Class;.getUpTime()Ljava/lang/String;"

Expected behavior

No crash

Actual behavior & steps to reproduce

Unknown – crash from production log. Full stack trace:

java.lang.NoSuchMethodError: no non-static method "Ljava/lang/Class;.getUpTime()Ljava/lang/String;"

com.swmansion.reanimated.NativeProxy$EventHandler.receiveEvent NativeProxy.java
com.swmansion.reanimated.NativeProxy$EventHandler.receiveEvent NativeProxy.java:57
com.mapbox.rctmgl.components.AbstractEvent.dispatch AbstractEvent.java:28
com.swmansion.reanimated.NodesManager.handleEvent NodesManager.java:517
com.swmansion.reanimated.NodesManager.onEventDispatch NodesManager.java:491
com.facebook.react.uimanager.events.EventDispatcherImpl.dispatchEvent EventDispatcherImpl.java:116
com.mapbox.rctmgl.components.AbstractEventEmitter.handleEvent AbstractEventEmitter.java:43
com.mapbox.rctmgl.components.mapview.RCTMGLMapView.handleMapChangedEvent RCTMGLMapView.java:1421
com.mapbox.rctmgl.components.mapview.RCTMGLMapView.sendRegionDidChangeEvent RCTMGLMapView.java:1401
com.mapbox.rctmgl.components.mapview.RCTMGLMapView$2.onCameraIdle RCTMGLMapView.java:466
com.mapbox.mapboxsdk.maps.CameraChangeDispatcher.executeOnCameraIdle CameraChangeDispatcher.java:140
com.mapbox.mapboxsdk.maps.CameraChangeDispatcher.access$300 CameraChangeDispatcher.java:21
com.mapbox.mapboxsdk.maps.CameraChangeDispatcher$CameraChangeHandler.handleMessage CameraChangeDispatcher.java:177
android.os.Handler.dispatchMessage Handler.java:106
android.os.Looper.loop Looper.java:223
android.app.ActivityThread.main ActivityThread.java:7723
java.lang.reflect.Method.invoke Method.java
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:612
com.android.internal.os.ZygoteInit.main ZygoteInit.java:997

Snack or minimal code example

Package versions

name version
react-native 0.65.1
react-native-reanimated 2.4.1

Affected platforms

github-actions[bot] commented 2 years ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snippet of code, a snack or a link to a GitHub repository that reproduces the problem?

github-actions[bot] commented 2 years ago

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Snack or minimal code example section.

piaskowyk commented 2 years ago

It looks like proguard configuration issue. Could you try to mark as required these classes in your proguard config?

DaniyarJakupov commented 2 years ago

Same issue here:

java.lang.NoSuchMethodError: no non-static method "Ljava/lang/Class;.getUpTime()Ljava/lang/String;"
    at com.swmansion.reanimated.NativeProxy$EventHandler.receiveEvent(NativeProxy.java)
    at com.swmansion.reanimated.NativeProxy$EventHandler.receiveEvent(NativeProxy.java:55)
    at com.swmansion.rnscreens.events.ScreenDismissedEvent.dispatch(ScreenDismissedEvent.kt:17)
    at com.swmansion.reanimated.NodesManager.handleEvent(NodesManager.java:485)
    at com.swmansion.reanimated.NodesManager.onEventDispatch(NodesManager.java:462)
    at com.facebook.react.uimanager.events.EventDispatcher.dispatchEvent(EventDispatcher.java:114)
    at com.swmansion.rnscreens.ScreenFragment.onDestroy(ScreenFragment.kt:260)
    at androidx.fragment.app.Fragment.performDestroy(Fragment.java:2927)
    at androidx.fragment.app.FragmentStateManager.destroy(FragmentStateManager.java:492)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1296)
    at androidx.fragment.app.FragmentManager.endAnimatingAwayFragments(FragmentManager.java:2251)
    at androidx.fragment.app.FragmentManager.saveAllState(FragmentManager.java:2380)
    at androidx.fragment.app.FragmentController.saveAllState(FragmentController.java:152)
    at androidx.fragment.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:512)
    at androidx.appcompat.app.AppCompatActivity.onSaveInstanceState(AppCompatActivity.java:533)
    at android.app.Activity.performSaveInstanceState(Activity.java:2242)
    at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1514)
    at android.app.ActivityThread.callActivityOnSaveInstanceState(ActivityThread.java:6353)
    at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:5712)
    at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:5642)
    at android.app.ActivityThread.handleStopActivity(ActivityThread.java:5743)
    at android.app.servertransaction.StopActivityItem.execute(StopActivityItem.java:43)
    at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2434)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8633)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

In our case enableProguardInReleaseBuilds is false.

"react-native-reanimated": "^2.2.4",
"react-native": "0.63.4",
kristfal commented 2 years ago

@piaskowyk we don't run Progard either, so this has us puzzled. Any suggestion for how to dig deeper?

tomekzaw commented 2 years ago

@kristfal Last month we renamed one of our internal methods from getUpTime to getUptime (see here). The error comes from C++ part of Reanimated trying to invoke getUptime method via JNI which does not exist now. It seems like there was some mismatch between C++ precompiled sources (distributed as shared library libreanimated.so within .aar) and Java sources.

hrupesh commented 2 years ago

Hi @tomekzaw , is there any possible fix for this in future?

mduthilleul commented 2 years ago

Same issue here. proguard not enabled, using react-native-reanimated 2.6.0.

Sumit-Budhiraja commented 2 years ago

Any update on this one.? Still facing this issue.

mylesdawson commented 2 years ago

Also facing this using react-native-reanimated 2.2.3, any updates would be greatly appreciated

sgtpsibin commented 2 years ago

+1 same issue

stephenkopylov commented 2 years ago

Facing the same

ReactNative: 0.68.2
react-native-reanimated: 2.8.0
jacob-li-hj commented 2 years ago

+1 same issue

  "react-native": "0.64.3"
  "react-native-reanimated": "2.3.3"
tomekzaw commented 2 years ago

Hey, do you use Expo managed workflow? If yes, then the JS version of Reanimated (in node_modules) must match the version from SDK.

jacob-li-hj commented 2 years ago

I don't use Expo managed workflow, I use react-native directly. And I haven't been able to reproduce this issue myself, just found the crash log in the prod environment

swathi2378 commented 2 years ago

Any update on this one? Still facing this issue.

github-actions[bot] commented 2 years ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?