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

Only the original thread that created a view hierarchy can touch its views. #16042

Closed
tuvshinbatgeru opened this issue Sep 21, 2017 · 21 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@tuvshinbatgeru
Copy link

This "Only the original thread that created a view hierarchy can touch its views" error given after react native version upgrade 44.2 to 47.2.

Environment:
OS: ubuntu 16.04
Node: 6.10.0
npm: 3.10.10
Watchman: 4.7.0
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react-native: 0.44.2 => 0.47.2
react: 16.0.0-alpha.12 => 16.0.0-alpha.12

Target Platform: Android (6.0.0)

@hramos
Copy link
Contributor

hramos commented Sep 21, 2017

Hey, thanks for reporting this issue!

It looks like your description is missing some necessary information, or the list of reproduction steps is not complete. Can you please add all the details specified in the template? This is necessary for people to be able to understand and reproduce the issue being reported.

I am going to close this, but feel free to open a new issue that meets the requirements set forth in the template. Thanks!

@hramos hramos closed this as completed Sep 21, 2017
@jhalborg
Copy link

I second this. Using Expo SDK 21 along with TypeScript 2.5, and getting consistent crashes on recompilation each time on Android.

I found my issue by viewing the stacktrace I could send to the dev (through the Android report bug feature). It was due to the following call:

abi21_0_0.com.facebook.react.devsupport.DebugOverlayController.setFpsDebugViewVisible(DebugOverlayConroller.java:49)

By turning off the Inspector module (for FPS perf etc), Expo stopped crashing.

@ThaJay
Copy link

ThaJay commented Oct 19, 2017

same problem, crashes on reload when perf monitor is visible.

"react-native": "^0.48.4",
"react": "^16.0.0",
E/AndroidRuntime(17714): FATAL EXCEPTION: main
E/AndroidRuntime(17714): Process: com.chipta, PID: 17714
E/AndroidRuntime(17714): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
E/AndroidRuntime(17714): 	at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:7093)
E/AndroidRuntime(17714): 	at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:1076)
E/AndroidRuntime(17714): 	at android.view.View.requestLayout(View.java:17416)
E/AndroidRuntime(17714): 	at android.view.ViewGroup.removeAllViews(ViewGroup.java:4198)
E/AndroidRuntime(17714): 	at com.facebook.react.devsupport.DebugOverlayController.setFpsDebugViewVisible(DebugOverlayController.java:49)
E/AndroidRuntime(17714): 	at com.facebook.react.devsupport.DevSupportManagerImpl.resetCurrentContext(DevSupportManagerImpl.java:610)
E/AndroidRuntime(17714): 	at com.facebook.react.devsupport.DevSupportManagerImpl.onReactInstanceDestroyed(DevSupportManagerImpl.java:516)
E/AndroidRuntime(17714): 	at com.facebook.react.ReactInstanceManager.tearDownReactContext(ReactInstanceManager.java:941)
E/AndroidRuntime(17714): 	at com.facebook.react.ReactInstanceManager.runCreateReactContextOnNewThread(ReactInstanceManager.java:793)
E/AndroidRuntime(17714): 	at com.facebook.react.ReactInstanceManager.recreateReactContextInBackground(ReactInstanceManager.java:782)
E/AndroidRuntime(17714): 	at com.facebook.react.ReactInstanceManager.onReloadWithJSDebugger(ReactInstanceManager.java:754)
E/AndroidRuntime(17714): 	at com.facebook.react.ReactInstanceManager.access$000(ReactInstanceManager.java:109)
E/AndroidRuntime(17714): 	at com.facebook.react.ReactInstanceManager$1.onReloadWithJSDebugger(ReactInstanceManager.java:157)
E/AndroidRuntime(17714): 	at com.facebook.react.devsupport.DevSupportManagerImpl.reloadJSInProxyMode(DevSupportManagerImpl.java:805)
E/AndroidRuntime(17714): 	at com.facebook.react.devsupport.DevSupportManagerImpl.handleReloadJS(DevSupportManagerImpl.java:650)
E/AndroidRuntime(17714): 	at com.facebook.react.devsupport.DevSupportManagerImpl$5.onOptionSelected(DevSupportManagerImpl.java:372)
E/AndroidRuntime(17714): 	at com.facebook.react.devsupport.DevSupportManagerImpl$15.onClick(DevSupportManagerImpl.java:470)
E/AndroidRuntime(17714): 	at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:1017)
E/AndroidRuntime(17714): 	at android.widget.AdapterView.performItemClick(AdapterView.java:308)
E/AndroidRuntime(17714): 	at android.widget.AbsListView.performItemClick(AbsListView.java:1510)
E/AndroidRuntime(17714): 	at android.widget.AbsListView$PerformClick.run(AbsListView.java:3472)
E/AndroidRuntime(17714): 	at android.widget.AbsListView$3.run(AbsListView.java:4835)
E/AndroidRuntime(17714): 	at android.os.Handler.handleCallback(Handler.java:733)
E/AndroidRuntime(17714): 	at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(17714): 	at android.os.Looper.loop(Looper.java:146)
E/AndroidRuntime(17714): 	at android.app.ActivityThread.main(ActivityThread.java:5653)
E/AndroidRuntime(17714): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(17714): 	at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(17714): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
E/AndroidRuntime(17714): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
E/AndroidRuntime(17714): 	at dalvik.system.NativeStart.main(Native Method)

@ephor
Copy link

ephor commented Nov 13, 2017

Also have this error on React-native 0.50.3 and android 8

@ThaJay
Copy link

ThaJay commented Nov 14, 2017

@hramos reopen?

@yimiIO
Copy link

yimiIO commented Nov 22, 2017

@hramos
same question,
I quick repeat click one button on Android, it will show my toast repeat, in a minute, crash.
ndroid.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:7361) at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:1156) at android.view.View.requestLayout(View.java:19841) at android.view.View.requestLayout(View.java:19841) at android.widget.TextView.checkForRelayout(TextView.java:7688) at android.widget.TextView.setText(TextView.java:4585) at android.widget.TextView.setText(TextView.java:4442) at android.widget.TextView.setText(TextView.java:4417) at com.xsl.kit.utils.ToastWrapper.updateToast(ToastWrapper.java:61)

@Venryx
Copy link
Contributor

Venryx commented Dec 7, 2017

I also have this issue, with Android 7, and:

"react": "^16.2.0",
"react-native": "^0.51.0",

It is fixed when I disable the performance-monitor overlay. (so seemingly a bug in react-native)

@CodingJbz
Copy link

thanks for @Venryx , it's works to me

@amosyuen
Copy link

@Venryx How do you disable the performance monitor overlay? Is it by shaking the phone and clicking the "Hider Perf Monitor"? I already did that, but still running into this error.

@Venryx
Copy link
Contributor

Venryx commented Jan 16, 2018

Yes, that's what fixed it for me. Must be another root-cause in your case.

@MariusMeiners
Copy link

I think the combination that breakes the System is having JS Dev Mode deactivated and Show performance Monitor true. Either one on its own seems to be working fine...

@mirsujat
Copy link

mirsujat commented Mar 3, 2018

Need Help

Only the original thread that created a view hierarchy can touch its views.
checkThread
ViewRootImpl.java:6357
requestLayout
ViewRootImpl.java:874
requestLayout
View.java:17476
removeAllViews
ViewGroup.java:4345
setFpsDebugViewVisible
DebugOverlayController.java:115
resetCurrentContext
DevSupportManagerImpl.java:599
onNewReactContextCreated
DevSupportManagerImpl.java:523
setupReactContext
ReactInstanceManager.java:995
access$1300
ReactInstanceManager.java:113
run
ReactInstanceManager.java:965
handleCallback
Handler.java:739
dispatchMessage
Handler.java:95
dispatchMessage
MessageQueueThreadHandler.java:31
loop
Looper.java:135
run
MessageQueueThreadImpl.java:194
run
Thread.java:818

@mirsujat
Copy link

mirsujat commented Mar 3, 2018

{
"main": "node_modules/expo/AppEntry.js",
"private": true,
"dependencies": {
"expo": "^25.0.0",
"react": "16.2.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz",
"react-navigation": "^1.3.2"
}
}

@jasonh9
Copy link

jasonh9 commented Mar 22, 2018

Show performance monitor = true caused this issue for me.

Running on android 8.0
react-native-cli: 2.0.1
react-native: 0.54.2

@macloving
Copy link

I am sorry, but how you click on the "Hider Perf Monitor"?
I have android 7.0 version. I cannot do it. Please, help me.

@Venryx How do you disable the performance monitor overlay? Is it by shaking the phone and clicking the "Hider Perf Monitor"? I already did that, but still running into this error.

@guilhermemauro
Copy link

Hide Perf Monitor works for me.

@dapperAuteur
Copy link

I got the same issue. I shut down the server and restarted it and the issue went away.

@joshuapinter
Copy link
Contributor

Toggling the "Perf Monitor" off solved the issue for me.

To do this you can use the following adb command to bring up the menu (or shake your device):

adb shell input keyevent KEYCODE_MENU

Then you'll see "Hide Perf Monitor". Press that to hide it.

2018-06-16_23-29-15

@ricardobeat
Copy link

Having the same issue. So Performance Monitor cannot be used along Live Reload? :(

@tereshchenkoartyom94
Copy link

Same issue? Are you going to fix it?

@andretf
Copy link

andretf commented Sep 8, 2018

It seems it has been solved in #17544, in beta version 0.57.

@facebook facebook locked as resolved and limited conversation to collaborators Sep 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests