react-native: Android emulator loses connection to debugger and becomes unresponsive

To reproduce:

  • Fire up a Genymotion emulator
  • react-native run-android on your project
  • Attach chrome debugger
  • Put an error in javascript, for example returns instead of return
  • Refresh your emulator (Cmd M, Reload)
  • Fix the error in your code
  • Refresh your emulator (Cmd M, Reload) again
  • Emulator will display dialog that says “Please wait… connecting to remote debugger”
  • There is no way to exit this state, except to close and reboot the emulator

Errors caught in the debugger in this situation are: GET http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false 500 (Internal Server Error) debuggerWorker.js:18 Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false' failed to load.messageHandlers.executeApplicationScript @ debuggerWorker.js:18onmessage @ debuggerWorker.js:33

I use Genymotion, usually test on APIs 16 & 21 which have both experienced this issue.

I am running React Native version 0.20.

I am running on a Mac.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 19
  • Comments: 18 (4 by maintainers)

Most upvoted comments

I thought this was fixed but it’s still a problem. The issue went away a while ago for me, but now it’s back. Maybe it has something to do with promises? I started using AsyncStorage last week. No errors come up, although I do sometimes get the unhandled promise rejection warning for no apparent reason.

same issue genymotion and real device windows 10 and osx 10.11.6 react-native 0.33

the fastest way to recover I found out is to ctrl+c then [up], [enter] the packager. This way the app crashes instantly and I can reload. Any other way makes android hang for ages.