Search code examples
react-nativereact-native-reanimatedkotlin1.4

Error running React Native 62.3 app with react-native-reanimated 1.13.2


UPDATE: there was a library trying to use React Native 64 or newer, and the EventDispatcher.java file changed a lot from 63.5 to 64+. That was the cause of expecting an Interface while i was running a class file.

Last week a project I have was building correctly, then an error started appearing out of nowhere when running it. It was a problem with the library invertase/react-native-apple-authentication about using Kotlin 1.6.0 in the metadata but was expecting Kotlin 1.4.0.

After forcing the project to use Kotlin 1.6.0 with kotlinVersion = "1.6.0" in build.gradle, now this error started appearing, after building successfully, the app crashes without warning, just closes completely, and this error appeared in the Logcat:

java.lang.IncompatibleClassChangeError: Found class com.facebook.react.uimanager.events.EventDispatcher, but interface was expected (declaration of 'com.facebook.react.uimanager.events.EventDispatcher' appears in /data/app/APP_NAME_ROUTE==/base.apk)
                                                                                                        at com.swmansion.reanimated.NodesManager.<init>(NodesManager.java:116)
                                                                                                        at com.swmansion.reanimated.ReanimatedModule.getNodesManager(ReanimatedModule.java:95)
                                                                                                        at com.swmansion.reanimated.ReanimatedModule.access$000(ReanimatedModule.java:24)
                                                                                                        at com.swmansion.reanimated.ReanimatedModule$1.execute(ReanimatedModule.java:80)
                                                                                                        at com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation.execute(UIViewOperationQueue.java:499)
                                                                                                        at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:792)
                                                                                                        at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:903)
                                                                                                        at com.facebook.react.uimanager.UIViewOperationQueue.access$2400(UIViewOperationQueue.java:43)
                                                                                                        at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:963)
                                                                                                        at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
                                                                                                        at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
                                                                                                        at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
                                                                                                        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1188)
                                                                                                        at android.view.Choreographer.doCallbacks(Choreographer.java:942)
                                                                                                        at android.view.Choreographer.doFrame(Choreographer.java:846)
                                                                                                        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1172)
                                                                                                        at android.os.Handler.handleCallback(Handler.java:938)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:211)
                                                                                                        at android.os.Looper.loop(Looper.java:300)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:8295)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:577)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1074)

Im not a native Java expert an im having trouble finding out how to fix this issue, if someone has a hint of at least how to approach, would be awesome.

React Native 62.3 React 16.11.0 react-native-reanimated: 1.13.2

Tried updating the invertase/react-native-apple-authentication library, the kotlin version, updating the react-native-reanimated library to 2.x but its a complete mess since I have more libraries that still use 1.x version.

Already tried upgrading the React Native version to the newest I could, but due to the nature of the proyect, some important libraries in the core of the project are very old and won´t work with the newer versions, if I can´t solve this issue for now, I will need to make a new project from scratch.


Solution

  • Solution: there was a library trying to use React Native 64 or newer, and the EventDispatcher.java file changed a lot from 63.5 to 64+. That was the cause of expecting an Interface while I was running a class file.