Virtual device running in Genymotion periodically goes offline in ADB

4.5k views Asked by At

I have an Android device (with Lollipop image, if important) running in Genymotion 2.4 and connect to it via ADB (version 1.0.32) from another developer PC with Eclipse in local network without connectivity problems. All is fine except for periodical drops of ADB connection (other protocols keep working fine), that is ADB loses the device, and when I try to reconnect it says that device is offline. From my experience, this offline status does basically mean that the receiving end (the device) still thinks it's connected and declines new connection. The only method I know to remedy this problem is to restart the device and then ADB connects to it as expected.

If someone is interested, ADB is not running on the remote host machine with Genymotion - otherwise the remove connections from other PCs would be impossible.

The question: how can I refresh "softly" the virtual device to accept new ADB connection without restarting entire device?

P.S. If I leave the "offline" device for its own for some time (quite a long time, for example, for an hour) it seems refreshes its state without external interaction, so ADB is again able to properly connect to and device is reported as "online". But, it makes no sense to wait so long for this to happen. This is just a new piece of information for consideration.

2

There are 2 answers

4
technoplato On

This may not work for you, but has worked for me in the situation where my device simply goes ADB offline. One of the comments on your question mentions that their emulator typically goes offline when their device sleeps. Mine does the same and also goes offline after long periods of inactivity, despite not actually sleeping. Anyway, my fix is plain and simple:

In terminal, navigate to where you have the SDK installed. Then, navigate to the directory platform-tools within your SDK, and issue the following command:

adb kill-server

After that finishes, type this one:

adb devices

That almost always fixes my problem, and I hope it fixes yours as well. Let me know how that works for you.

3
localhost On

If you use MacOS Sierra - there is a known bug in it.

28.11.2016 There is no workaround yet except restarting adb which is suggested in @lustig answer.

  • Google gonna fix it in Android Studio 2.3. Issues to track 82425, 216214
  • There is no info about will Apple fix it on their side or not.