react-native: Unable to find JSIModule for class UIManager
Description
After update to React native 0.64.0 many people have Unable to find JSIModule for class UIManager
crash.
There was no crash on the 0.63.4.
Related issues
https://github.com/software-mansion/react-native-gesture-handler/issues/1284 https://github.com/react-native-community/releases/issues/221#issuecomment-805540303
React Native version:
React native info
System: OS: macOS 11.2.3 CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 1.08 GB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 15.12.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.6.3 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 Android SDK: API Levels: 29, 30 Build Tools: 28.0.3, 29.0.2, 30.0.1 System Images: android-21 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 4.1 AI-201.8743.12.41.7199119 Xcode: 12.4/12D4e - /usr/bin/xcodebuild Languages: Java: 1.8.0_282 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.1 => 17.0.1 react-native: 0.64.0 => 0.64.0 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not FoundSteps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- Render PanGestureHandler
- Render RNCamera
- Press on camera view port
Logcat
Logcat
2021-03-26 15:55:59.361 18259-18259/com.jsimodule E/InputEventReceiver: Exception dispatching input event. 2021-03-26 15:55:59.361 18259-18259/com.jsimodule E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback 2021-03-26 15:55:59.363 18259-18259/com.jsimodule E/MessageQueue-JNI: java.lang.IllegalArgumentException: Unable to find JSIModule for class UIManager at com.facebook.react.bridge.JSIModuleRegistry.getModule(JSIModuleRegistry.java:24) at com.facebook.react.bridge.CatalystInstanceImpl.getJSIModule(CatalystInstanceImpl.java:564) at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:90) at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:46) at com.facebook.react.uimanager.UIManagerHelper.getUIManagerForReactTag(UIManagerHelper.java:40) at com.facebook.react.animated.NativeAnimatedNodesManager.handleEvent(NativeAnimatedNodesManager.java:505) at com.facebook.react.animated.NativeAnimatedNodesManager.onEventDispatch(NativeAnimatedNodesManager.java:483) at com.facebook.react.uimanager.events.EventDispatcherImpl.dispatchEvent(EventDispatcherImpl.java:116) at com.facebook.react.uimanager.JSTouchDispatcher.handleTouchEvent(JSTouchDispatcher.java:74) at com.facebook.react.ReactRootView.dispatchJSTouchEvent(ReactRootView.java:283) at com.facebook.react.ReactRootView.onInterceptTouchEvent(ReactRootView.java:201) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2664) at com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView.dispatchTouchEvent(RNGestureHandlerEnabledRootView.java:39) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:488) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1871) at android.app.Activity.dispatchTouchEvent(Activity.java:4125) at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:446) at android.view.View.dispatchPointerEvent(View.java:14568) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6016) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5819) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5310) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5485) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5542) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8080) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8031) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7992) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8203) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:220) at android.os.MessageQueue.nativePollOnce(Native Method) 2021-03-26 15:55:59.363 18259-18259/com.jsimodule E/MessageQueue-JNI: at android.os.MessageQueue.next(MessageQueue.java:335) at android.os.Looper.loop(Looper.java:183) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 2021-03-26 15:55:59.364 18259-18259/com.jsimodule D/AndroidRuntime: Shutting down VM--------- beginning of crash
2021-03-26 15:55:59.366 18259-18259/com.jsimodule E/AndroidRuntime: FATAL EXCEPTION: main Process: com.jsimodule, PID: 18259 java.lang.IllegalArgumentException: Unable to find JSIModule for class UIManager at com.facebook.react.bridge.JSIModuleRegistry.getModule(JSIModuleRegistry.java:24) at com.facebook.react.bridge.CatalystInstanceImpl.getJSIModule(CatalystInstanceImpl.java:564) at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:90) at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:46) at com.facebook.react.uimanager.UIManagerHelper.getUIManagerForReactTag(UIManagerHelper.java:40) at com.facebook.react.animated.NativeAnimatedNodesManager.handleEvent(NativeAnimatedNodesManager.java:505) at com.facebook.react.animated.NativeAnimatedNodesManager.onEventDispatch(NativeAnimatedNodesManager.java:483) at com.facebook.react.uimanager.events.EventDispatcherImpl.dispatchEvent(EventDispatcherImpl.java:116) at com.facebook.react.uimanager.JSTouchDispatcher.handleTouchEvent(JSTouchDispatcher.java:74) at com.facebook.react.ReactRootView.dispatchJSTouchEvent(ReactRootView.java:283) at com.facebook.react.ReactRootView.onInterceptTouchEvent(ReactRootView.java:201) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2664) at com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView.dispatchTouchEvent(RNGestureHandlerEnabledRootView.java:39) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2742) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:488) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1871) at android.app.Activity.dispatchTouchEvent(Activity.java:4125) at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:446) at android.view.View.dispatchPointerEvent(View.java:14568) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6016) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5819) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5310) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5485) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5542) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8080) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8031) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7992) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8203) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:220) 2021-03-26 15:55:59.366 18259-18259/com.jsimodule E/AndroidRuntime: at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:335) at android.os.Looper.loop(Looper.java:183) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
--------- beginning of system
2021-03-26 15:55:59.386 18259-18259/com.jsimodule I/Process: Sending signal. PID: 18259 SIG: 9
Expected Results
No crash
Snack, code example, screenshot, or link to a repository:
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 57
- Comments: 46 (15 by maintainers)
Commits related to this issue
- Refactor UIManagerHelper.getUIManager to return null when there's no UIManager registered Summary: This diff refactors the UIManagerHelper.getUIManager method to return null when there's no UIManager... — committed to facebook/react-native by mdvacca 3 years ago
- Refactor UIManagerHelper.getUIManager to return null when there's no UIManager registered Summary: This diff refactors the UIManagerHelper.getUIManager method to return null when there's no UIManager... — committed to facebook/react-native by mdvacca 3 years ago
- Refactor UIManagerHelper.getUIManager to return null when there's no UIManager registered Summary: This diff refactors the UIManagerHelper.getUIManager method to return null when there's no UIManager... — committed to feastr/react-native by mdvacca 3 years ago
- Refactor UIManagerHelper.getUIManager to return null when there's no UIManager registered Summary: This diff refactors the UIManagerHelper.getUIManager method to return null when there's no UIManager... — committed to savv/react-native-savv by mdvacca 3 years ago
- Refactor UIManagerHelper.getUIManager to return null when there's no UIManager registered Summary: This diff refactors the UIManagerHelper.getUIManager method to return null when there's no UIManager... — committed to facebook/react-native by mdvacca 3 years ago
We are working on a fix that’s currently on review.
@ejanzer, @sharifhh, @mikehardy thanks for looking into this.
I agree with @ejanzer that this is caused by views that are not directly managed by React Native. In particular, we are referring to views that are not created by this method:
https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java#L140-L141
I’ll analyze what’s the proper solution here and update the issue
Can we get a patch until RN 0.64.2 is released?
This is quite an issue for apps using RN 0.64 in production.
Fixed in 0.64.2
Hi, any update on this issue? Thanks for all!
@efstathiosntonas interesting
It creates a View directly itself: https://github.com/hhunaid/react-native-image-crop-tools/blob/5c3ab05dca20cefe542fd3824a40cef0ae2d2541/android/src/main/java/com/parsempo/ImageCropTools/ImageCropViewManager.kt#L31
going in to here https://github.com/ArthurHub/Android-Image-Cropper/blob/2a4a425668bfff1329dd5bfb1b80b0829bb4cc67/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageView.java#L178
Then the id for that View is apparently indigestible: https://github.com/hhunaid/react-native-image-crop-tools/blob/5c3ab05dca20cefe542fd3824a40cef0ae2d2541/android/src/main/java/com/parsempo/ImageCropTools/ImageCropViewManager.kt#L39
So, still seems to be the same case of “JSIModule is making an assumption about View ids that is no longer valid” and I believe we are still waiting for @mdvacca to report any findings as promised above
I’m not using
react-native-tab-view
or@react-native-picker/picker
. I downgraded RN to0.63.4
until a fix has been found in0.64
.The problem here is happening because the View getId() function is returning an even number and in react native code if the id is even it will use FABRIC and JSI and UIManager doesn’t support that, so it is breaking, now the question is why it generates even number, I tried to downgrade to react-native 0.63.4 and it worked, after that I upgraded back to 0.64 and did a small trick in the library that is crashing, I did the following findViewById(R.id.ID_OF_THE_ROOT_LAYOUT).setId(10023);
I believe this should be closed, as there is a commit on master and it’s been picked to release-0.65 as well
Got the same issue when using
react-native-pager-view
. For your case, the different betweenreact-native-tab-view
v2.16.0
andv3.0.0
is that v3 usedpager-view
so maybe that’s the root cause?Normally that will have no effect if I understand correctly as the android code is pre-built and depended on as an aar, running react native from source has its own documentation. It can certainly work though if you follow it through
any progress?
I found that pressing my location button on
react-native-maps
reproduces the same crash on AndroidI think @mdvacca is probably the right person to weigh in on this one! It seems like the JS touch handler assumes it’s only dealing with views that were created by React (in which case an even id == fabric) but that’s clearly… not always the case?
@Bardiamist I was able to resolve my case. It was caused by the usage of
react-native-tab-view
(v3.0.0) and@react-native-picker/picker
(v1.12.0) on the same screen. When I downgradedreact-native-tab-view
to v2.16.0 the error disappeared.More details here -> https://github.com/satya164/react-native-tab-view/issues/1157
@mikehardy, it worked, Thanks
It is
On Fri 4 Jun 2021 at 18:01, Juan S. Escobar @.***> wrote:
– Erwan
@ebaynaud web search for building / running react native from source
@mtroskot I think the way it goes is that as soon as that commit lands on master you post a cherry pick request to the RN064.1 and RN0.65 cherry picks conversation - which I have just done 😃
in my case using
react-native-image-crop-tools
is crashing when trying to move the crop box with the finger, this module is using UIManager directlyI was able to easily reproduce this issue with:
just mount this on some image and try to zoom with two fingers (even clicking into it make a crash)
@sharifhh that’s great digging - if I git blame on there it all seems to point to @mdvacca and possibly @ejanzer (going from this https://github.com/facebook/react-native/commit/0a12f3ea77840c218fd9d67d0e3f2ea068cb8c5f) - I think they might know more about the even/odd partitioning of dispatch event handling and specifically in the last commit how what appears to be a new exception raised affects other modules. Hopefully one of them has time to share their wisdom here on the crash as I think it’s related to that change