Any attempt to open the debugger throws a NetworkOnMainThread exception
See original GitHub issueI apologize because I don’t have a solid repro other than running my project, but I have narrowed it down to Haul because switching back to the react-native packager allows the app to function properly.
Current Behavior
When connecting to the remote debugger, the app crashes with a NetworkOnMainThreadException:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.hubspot.android.debug, PID: 13213
android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@bdb46cb -- permission denied for window type 2003
at android.view.ViewRootImpl.setView(ViewRootImpl.java:703)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:342)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
at android.app.Dialog.show(Dialog.java:322)
at com.facebook.react.devsupport.DevSupportManagerImpl.showProgressDialog(DevSupportManagerImpl.java:808)
at com.facebook.react.devsupport.DevSupportManagerImpl.reloadJSFromServer(DevSupportManagerImpl.java:813)
at com.facebook.react.devsupport.DevSupportManagerImpl.handleReloadJS(DevSupportManagerImpl.java:648)
at com.facebook.react.ReactInstanceManager$3$1.run(ReactInstanceManager.java:420)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
To compound this problem, because the debugger tries to auto-reconnect, the only way to get the app to work is to uninstall and reinstall, otherwise this will get triggered on every launch.
Expected Behavior
I should be able to open the chrome debugger
Haul Configuration (webpack.haul.js)
module.exports = ({ platform }, { resolve }) => ({
entry: `./index.${platform}.js`,
resolve: Object.assign(resolve, {
alias: Object.assign({
Immutable: 'immutable'
}, resolve.alias || {}, myAliases)
})
});
Your Environment
| software | version |
|---|---|
| Haul | latest |
| react-native | 0.43.0 |
| node | 7.8.0 |
| npm or yarn | yarn 0.21.3 |
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
How can I fix 'android.os.NetworkOnMainThreadException'?
"Due to a bug in previous versions of Android, the system did not flag writing to a TCP socket on the main thread...
Read more >How to Fix "android.os.Network On Main Thread Exception ...
When an app attempts to perform networking operations on the main thread a Network On Main Thread Exception Error is thrown.
Read more >NetworkOnMainThreadException when using HttpClient #5264
You'll observe NetworkOnMainThreadException being thrown on the last line, when we attempt to Dispose of the HttpResponseMessage.
Read more >How to fix android.os.NetworkOnMainThreadException error
A NetworkOnMainThreadException is thrown when an app attempts to perform networking operations on the main thread. The error appears on all applications ...
Read more >Modern Android Development - Marcos Placona's Blog
NetworkOnMainThreadException in modern Android applications. ... perform a networking operation on the main thread, an exception is thrown.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Another think I’m noticing is that the debugger continually tries to load on 10.0.2.2 (which I indicated above), I have to manually change the URL to localhost
As per your previous reply, this is an issue in React Native and not haul. So there’s not much point of keeping this issue open. It’s not actionable for us.