I can connect the device via USB and manage to play the app from Android studio without issues. Then I do adb tcpip 5555 and adb connect <IP_ADDRESS:PORT> without problems. Same goes for running the app.

But for some reason, when the device goes to sleep (screen shuts down), so does the connection to ADB. I configured the Wi-Fi settings to be "Always" so that shouldn't be the problem. I tried restarting the device and the PC, even re-installing the drivers but no luck.

Here's what I get from Logcat in the last seconds before the screen shuts down:

07-28 20:23:17.924     997-1222/? I/PowerManagerService﹕ Nap time (uid 1000)...
07-28 20:23:17.924     997-1222/? I/PowerManagerService﹕ Going to sleep due to screen timeout (uid 1000)...
07-28 20:23:18.477     997-1222/? D/bsthal﹕ activate, handle: 2, enabled: 0, index 5
07-28 20:23:18.490     997-1219/? I/DisplayManagerService﹕ Display device changed: DisplayDeviceInfo{"Schermo incorporato": 720 x 1280, 60.0 fps, supportedRefreshRates [60.0], density 320, 294.967 x 295.563 dpi, appVsyncOff 0, presDeadline 17666667, touch INTERNAL, rotation 0, type BUILT_IN, state OFF, FLAG_DEFAULT_DISPLAY, FLAG_ROTATES_WITH_CONTENT, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
07-28 20:23:18.496      997-997/? V/ActivityManager﹕ Display changed displayId=0
07-28 20:23:18.551      317-317/? D/SurfaceFlinger﹕ Set power mode=0, type=0 flinger=0xb7459550
07-28 20:23:18.557      317-317/? D/qdhwcomposer﹕ hwc_blank: Blanking display: 0
07-28 20:23:18.796      317-804/? I/qdhwcomposer﹕ handle_blank_event: dpy:0 panel power state: 0
07-28 20:23:18.800      317-317/? I/qdhwcomposer﹕ enable_dcabc: Done setting OFF mode
07-28 20:23:18.800      317-317/? D/qdhwcomposer﹕ hwc_blank: Done blanking display: 0
07-28 20:23:18.801      317-317/? I/SFPerfTracer﹕ triggers: (rate: 26:893) (compose: 0:2) (post: 0:0) (render: 0:16) (19:9416 frames) (20:12477)
07-28 20:23:18.801      317-317/? D/SFPerfTracer﹕ layers: (5:10) (FocusedStackFrame (0xb74da368): 0:156)* (DimLayer (0xb756f868): 0:19)* (DimLayer (0xb7572170): 0:7)* (StatusBar (0xb755f198): 2:8497) (com.android.systemui.ImageWallpaper (0xb7564e30): 0:499) (com.teslacoilsw.launcher/com.teslacoilsw.launcher.NovaLauncher (0xb7592e58): 0:195) (NavigationBar (0xb7562cf0): 0:18) (ColorFade (0xb7568e60): 20:22)
07-28 20:23:18.805     997-1347/? D/SurfaceContro
device not found

And when the screen shutdowns completely, the device simply disconnects mid transmission.

It seems I can connect to it after it had disconnected and went in IDLE. This is the log i managed to get by connecting to the device the second it disconnected: http://pastebin.com/afqpA0Ch

EDIT: I tried creating a new user on the phone and connecting it via wi-fi to adb, and it seems the problem does not present itself with this new account. I'll try factory-resetting the device and see if I can solve the problem for good.

I have a Motorola G 2014, XT1068, with Android 5.0.2, and running Android Studio on Windows x64 Home Premium.

How do I stop the device from disconnecting from ADB?

  • You might find this question helpful and related. See if any of those solutions work for you.
    – Lucky
    Jul 28, 2015 at 20:07
  • Have you installed any Battery saving apps? I had the same problem in Moto G2 and the problem was due to the Battery Doctor app that I used to kill apps and improve performance on screen lock, which also disable the wifi and restricted my whatsapp communications. Make sure you change the settings or uninstall those apps and try. These apps block your wifi network even if you have set your wifi mode to stay alive when your device screen is locked.
    – Lucky
    Jul 28, 2015 at 20:12
  • A few days ago I installed Qualcomm's "Snapdragon BateryGuru", though in less than 24Hours i uninstalled it. I don't have any other applications that do this. I'll try and re-install it and reset the settings from it.DCHP settings shouldn't be a problem. I had the leasing time set to 24hours for a few years and didn't give this problem a few months ago. I did set a static IP for the specific MAC address of the device, though that doesn't change anything. Jul 28, 2015 at 20:16
  • If you have uninstalled it then it wont have any effect on your wifi mode. Don't reinstalled the app again.!! This will make it worse since you dont want to have one more app that may chage your settings. Look for some other apps related to battery and performance which do these things normally. If not then it might be your routers problem so try using the adb using a different network and see if the problem persists.
    – Lucky
    Jul 28, 2015 at 20:19
  • Check if this tiny app Wi-Fi keep Alive from google play store helps.
    – Lucky
    Jul 28, 2015 at 20:29

1 Answer 1


So it seems the problem was with the settings of the device. Having a Screen Lock (even if SmartLock is enabled, and you are in a "safe location") disconnects ADB on device idle. Only way around it for me was to disable the device screen lock.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .