Skip to content
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

java.lang.IllegalStateException: Expect view tag to be set on CodePush restart #715

Closed
jakemmarsh opened this issue Jul 28, 2019 · 31 comments
Labels
BugBash 31.03 Close when stale The issue will be closed automatically if it remains inactive Platform: Android This issue is specific to Android

Comments

@jakemmarsh
Copy link

jakemmarsh commented Jul 28, 2019

My app is running react-native 0.60.4 and react-native-gesture-handler 1.3.0. It also uses react-native-code-push 5.6.0 for OTA updates.

It checks for and installs any new updates on app launch. After installation, the app is restarted with the new version. Upon restart, my Android users are frequently hitting an exception:

IllegalStateException
Expect view tag to be set for com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView{3cdcdcc V.E...... ........ 0,0-1440,2392}
com.swmansion.gesturehandler.react.RNGestureHandlerRootHelper in <init> at line 45
com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView in initialize at line 49
com.swmansion.gesturehandler.react.RNGestureHandlerModule$2 in execute at line 603
com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation in execute at line 530
com.facebook.react.uimanager.UIViewOperationQueue$1 in run at line 844
com.facebook.react.uimanager.UIViewOperationQueue in flushPendingBatches at line 952
com.facebook.react.uimanager.UIViewOperationQueue in access$2200 at line 44
com.facebook.react.uimanager.UIViewOperationQueue$2 in runGuarded at line 910
com.facebook.react.bridge.GuardedRunnable in run at line 24
android.os.Handler in handleCallback at line 873
android.os.Handler in dispatchMessage at line 99
android.os.Looper in loop at line 193
android.app.ActivityThread in main at line 6718
java.lang.reflect.Method in invoke
com.android.internal.os.RuntimeInit$MethodAndArgsCaller in run at line 495
com.android.internal.os.ZygoteInit in main at line 858

Any previous issues I've found around this exception mention issues with componentDidMount state logic inside gesture handler components. However, I don't believe I'm doing any of that. The only component I'm using directly is Swipeable.

@kaanduraa
Copy link

same issue for
react native 0.59.5
react-native-code-push 5.6.0
react-native-gesture-handler 1.1.0

@HarshitMadhav
Copy link

@jakemmarsh Follow this comment facebook/react-native#25924 (comment)

for react-native version > 0.60 you are missing the androidx support for the react native gesture handler as react-native gesture handler is not upgraded yet for androidx support.

@kaanduraa
Copy link

@HarshitMadhav error also exists for version 0.59.5, below 0.60

@HarshitMadhav
Copy link

@capslock35 because by default androidx is enabled and this react-native gesture handler doesnt have the support for androidx till now. Run the command gradlew app:dependencies in android folder to know which libraries of your project are using androidx

@asleepace
Copy link

Any update for this, happening to me on react native 0.59.10?

@HarshitMadhav
Copy link

@asleepace read out my last comment

@asleepace
Copy link

@HarshitMadhav androidx is only on react native 0.60+ but I'm using a lower version and this still occurs on some android devices. Seems to be a race condition.

@HarshitMadhav
Copy link

No, somehow your project might be using the updated androidx support third party library. run gradlew app:dependencies to check which library is using androidx and try running the project removing that library and then installing the android library only.

@mrigo
Copy link

mrigo commented Sep 16, 2019

Hello, I've the same problem here, using react native 0.60.5, I've this error:

Expect view tag to be set for com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView

I'm using jetifier but still having this issue..

@learnyst
Copy link

We are also facing the same issue. We are using Reacr-native 60.4 and also using code-push

@learnyst
Copy link

@HarshitMadhav we are using RN 0.60.4 and also code push. RN 0.60.4 uses androidx. How to resolve this issue for RN 0.60.4? also we noticed this issue only after code push update

@skoob13
Copy link

skoob13 commented Sep 30, 2019

We're also facing this issue. I can't say definitely that the issue appears after Code Push update, but I see logs for users, that haven't installed the update yet.

RN: 0.59.10
RNGH: 1.4.1

@mrigo
Copy link

mrigo commented Sep 30, 2019

Check that your view is a real view, a react component, and that the view is the only thing currently on the screen.
I've added an alert("ok") for testing the startup of the app in the index.js file (shame on me) and the alert was the view on the screen at the startup of the app, so react native gesture was searching for the tag on an alert and not on a component...

@tylorr
Copy link

tylorr commented Nov 12, 2019

We are seeing this issue with the following versions, we also run jetifier on postinstall

"react-native": "0.61.2"
"react-native-gesture-handler": "1.4.1"
"react-native-code-push": "5.6.0"

Any suggestion on a path forward?

@schumannd
Copy link

facing the same issue in RN 61.4

"react-native": "0.61.4",
"react-navigation": "4.0.10",
"react-navigation-stack": "1.10.3",
"react-navigation-tabs": "2.5.6",
"react-native-gesture-handler": "1.5.0",

@schumannd
Copy link

@jakemmarsh how did you end up working around this bug?

@jakemmarsh
Copy link
Author

@schumannd unfortunately I didn't. Priorities have shifted but the bug was still occurring last I knew.

@tylorr
Copy link

tylorr commented Nov 20, 2019

My issue was caused by attempting to navigate to a different screen while CodePush was trying to restart. Stopping that fixed the issue for me.

@danut-t
Copy link

danut-t commented May 27, 2020

Hello, any updates for this? The same issue is still happening with the following versions:

"react-native": "0.61.5",
"react-native-code-push": "6.2.0",
"react-native-gesture-handler": "1.6.1",
"react-navigation": "4.3.9"

@gif0101
Copy link

gif0101 commented Jun 19, 2020

Same issue as danut-t with :

"react-native": "0.61.5",
"react-native-code-push": "6.2.0",
"react-native-gesture-handler": "1.6.1",
"react-navigation": "4.3.9"

@grantgeorge
Copy link

We're getting this error as a crash for prod builds.

I can confirm it's after a CodePush sync has been fired

@fukuball
Copy link

Same issue

"react-native": "0.61.5",
"react-native-code-push": "6.2.1",
"react-native-gesture-handler": "1.6.1",
"react-navigation": "4.4.0"

@crwecker
Copy link

Same issue

"react-native": "0.63.2",
"react-native-code-push": "6.3.0",
"react-native-gesture-handler": "1.7.0",
"@react-navigation/native": "5.7.3"

@ANIBIT14
Copy link

Same issue in our production app hope someones provide a solution:
react-native: 062.2
"react-native-gesture-handler": "version": "1.7.0",
"react-navigation": "version": "4.3.9",

@jakub-gonet jakub-gonet added the Platform: Android This issue is specific to Android label Sep 3, 2020
@jakub-gonet jakub-gonet changed the title java.lang.IllegalStateException: Expect view tag to be set on CodePush restart in Android java.lang.IllegalStateException: Expect view tag to be set on CodePush restart Sep 3, 2020
@luatnd
Copy link

luatnd commented Sep 7, 2020

Trying to navigate when codePush.restartApp() cannot reproduce the error :(

@nadav2051
Copy link

Happening to me too, RN63.3, RNGestureHandler:
"react-native-gesture-handler": "1.6.1",
"react-native": "0.63.3",

@ulbekovad
Copy link

We've got a lot of cases with such issue in Crashlytics. Mostly for Android 9, 10 and 11.
"react-native-gesture-handler": "1.6.0",
"react-native": "0.62.2".

@HarshitMadhav should adding "npx jetify" at the postinstall step fix such issue?

@chgsilva
Copy link

chgsilva commented Mar 2, 2021

same issue here, any workarounds?

@snehalm-iprogrammer
Copy link

Fatal Exception: java.lang.IllegalStateException: java.lang.IllegalStateException: Expect view tag to be set for com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView{bbcb787 V.E...... ........ 0,0-1080,2400}
at com.facebook.react.bridge.ReactContext.handleException(ReactContext.java:390)
at com.facebook.react.bridge.ReactContext$ExceptionHandlerWrapper.handleException(ReactContext.java:397)
at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:33)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7565)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

Got this error on google console and there are many crashes due to it. Any solution?

@netshade
Copy link

netshade commented Apr 9, 2021

I also get a fair number of crashes here. Looking at the code that triggers it here: https://github.com/software-mansion/react-native-gesture-handler/blame/master/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.java#L44-L47 , I'm trying to understand what would cause it to get into this state. The React Native code that exercises it ( https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java#L100-L107 by way of https://github.com/software-mansion/react-native-gesture-handler/blob/master/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java#L603 ) seems to absolutely have a tag associated with the View ( otherwise, how could the exception even be reached? ), but the id of the View is < 1. And that is also confusing to me, because my reading of that seems to indicate that any id < 1 is invalid, but my presumption looking at Android / the view resolver is that any integer value of id that is not View.NO_ID ( -1 , see: https://developer.android.com/reference/android/view/View?authuser=3#NO_ID ) is a valid id. However, is there some other React Native protocol that needs to be followed here? Is View id 0 special somehow and that is also being accommodated for? I'd be happy to submit a PR that is in the neighborhood of trying to address this, but would want to know that I'm not ignoring other React Native protocols that are in play here.

cc @kmagiera who wrote the original exception here, just in case you have any insight afa what might be up.

@kkafar
Copy link
Member

kkafar commented Mar 31, 2022

Can any one verify, that the problem disappears when this PR is released (or try building from source)?

@kkafar kkafar added the Close when stale The issue will be closed automatically if it remains inactive label Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugBash 31.03 Close when stale The issue will be closed automatically if it remains inactive Platform: Android This issue is specific to Android
Projects
None yet
Development

No branches or pull requests