react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Android emulator loses connection to debugger and becomes unresponsive

Open KioKrofovitch opened this issue 10 years ago • 18 comments

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.

KioKrofovitch avatar Mar 11 '16 00:03 KioKrofovitch

I've heard about this, might be something that got broken between 0.19 and 0.20. Does anyone know the root cause?

mkonicek avatar Mar 20 '16 19:03 mkonicek

Confirmed. Very frustrating. You can press the hardware buttons to go to say the home screen so the device is responsive, but the "Connecting to the remote debugger' popup stays on top of everything so you click click anywhere.

robclouth avatar Mar 21 '16 13:03 robclouth

Seen this quite frequently on 0.17 as well

atticoos avatar Mar 25 '16 23:03 atticoos

This happens on 0.21, 0.22 with stock emulator, with Genymotion.

serialx avatar Mar 28 '16 13:03 serialx

Confirmed Ubuntu with RN 0.21 and 0.22 and Genymotion

bzlies avatar Mar 29 '16 05:03 bzlies

I've upgraded to latest and debug in chrome was not working. So I created a new app from scratch using react-native-cli 2.0. Debugging was working. So I compared all android files for things missed by the upgrade script. I've found the following differences: allprojects { repositories { mavenLocal() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$projectDir/../../node_modules/react-native/android" } } } android/app/build.gradle the compile version was still showing 0.18

dependencies { compile fileTree(dir: "libs", include: ["*.jar"]) compile "com.android.support:appcompat-v7:23.0.1" compile "com.facebook.react:react-native:+" }

I rebuilt the app, now Debugging works again. Hope it helps. Santiago

sesteva avatar Apr 02 '16 18:04 sesteva

I get this in chrome console: 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&minify=false' failed to load. I'm using the android emulator and it also gets stuck on that message: Please wait...Connecting to remote debugger.

How to stop this without shutting down all processes?

sdbeng avatar Jun 20 '16 18:06 sdbeng

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.

ThaJay avatar Jun 28 '16 12:06 ThaJay

Don't even have asyncstorage, blank project with only react-native-maps and it does it here and then. Very annoying to recover from.

Elyx0 avatar Jul 22 '16 00:07 Elyx0

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.

ThaJay avatar Jul 22 '16 09:07 ThaJay

@ThaJay could you expand what you mean by [up], [enter] the packager? I'm having this problem as well (and also wonder if it has something to do with promises)

mi-lee avatar Aug 28 '16 20:08 mi-lee

I just meant running the command again in your terminal. But in the newer versions it seems you can just press the back button on device or emulator to cancel the loading modal so you can open the dev menu again.

ThaJay avatar Aug 29 '16 10:08 ThaJay

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

laclance avatar Sep 12 '16 18:09 laclance

This issue is a real bummer. Having remote JS debugging and live reloading both enabled causes constant issues because of this -- if you save a file with a syntax error everything breaks and you have to kill and reload the app manually.

naiyt avatar Oct 04 '16 16:10 naiyt

Press the back button on device or emulator to cancel the loading modal doesn't work for me using 0.34. The fastest way to recover I found to kill the app:

adb shell am force-stop com.my.app.package

where com.my.app.package is the package name

penpalapp avatar Oct 06 '16 17:10 penpalapp

i hope this can help you,it help me solution this problem. [(http://stackoverflow.com/questions/41088268/conditional-rendering-error-in-react-native)]

dufeisolo avatar Dec 21 '16 03:12 dufeisolo

Closing this issue because it has been inactive for a while. If you think it should still be opened let us know why.

hramos avatar May 25 '17 20:05 hramos

I still have this issue with 0.48RN, where if I enable debug remotely and uses react native debugger at jhen0409/react-native-debugger, the app in genymotion just basically stops working.

pencilcheck avatar Oct 21 '17 08:10 pencilcheck