Android Studio Bumblebee (2021.1.1) was released stably on 25 January 2022 bundled with a new Device Manager (accompanying new support for Android 11+ device debugging over WIFI). I jumped on this stable release, updating from Android Studio Arctic Fox (2020.3.1 Patch 4).
Unfortunately however, since updating, physical devices/handsets don’t remain connected to Android Studio for the purpose of debugging. I can confirm that the issue was introduced from Android Studio Bumblebee onwards (occurring in Beta and Canary builds also). I’ve reproduced the issue on Android Studio Bumblebee (Stable), Chipmunk (Beta), and Dolphin (Canary), but Android Studio Arctic Fox (superseded Stable) continues to work just fine.
The issue occurs soon after opening Android Studio (Bumblebee+) with one of my physical devices connected. Everything appears fine initially and I may even have enough time to deploy my project to the handset, before the device disappears from Android Studio (as if I’d physically disconnected the USB cable from my computer or from the handset itself).
I’ve tried a fair few things in an attempt to determine a root cause. These include testing:
- With different USB cables.
- With different handsets (both varying makes and models).
- With various versions of the Android Studio IDE (as mentioned above).
- Plugging the USB cables into different USB ports on my computer.
- Rebooting handsets and my computer.
- Restarting Android Studio.
- Invalidating caches and restarting Android Studio.
adb kill-server
thenadb start-server
.- Revoking/reaccepting USB debugging authorization.
- Reinstalled build tools/platform tools, and ADB.
- A great number of further possibilities, to no avail.
I searched and read through remotely similar issues, including (but not limited to) these:
- Android Studio Arctic Fox (Adb) – Connected Devices are being disconnected after some time
- Android debugger continually disconnects
This particular comment in one of the above issues clued me onto a possible root cause:
I have been fighting for a few days with adb not seeing my device. After trying many other posted solutions, I discovered that the issue was with Chrome also trying to connect its debugger to a web view. If Chrome is connected using chrome://inspect, then adb seems to disconnect. Quitting Chrome resolves the issue. Then I can connect with Android Studio and then restart Chrome and reconnect. Hope this helps someone else.
However I’ve been unable to do anything with the above discovery, other than close Google Chrome, and hope for the best. Obviously this isn’t an ideal solution. It appears as though the moment Google Chrome shows the connected physical device in the chrome://inspect/#devices page, the physical device promptly becomes unavailable through Android Studio.
I’ve jumped back to Android Studio Arctic Fox (2020.3.1 Patch 4) for the moment, however this brings with it other issues (my current core project targets the latest SDK version, which requires the updated IDE).
Absolutely any help with this would be insanely appreciated. I’ve exhausted just about every avenue that I can think of!
4
Answers
I solved the problem by disabling
Settings -> Build, Execution, Deployment -> Debugger -> "Enable adb mDNS for wireless debugging"
I’m developing for android for almost 10 years now and I’m struggling with this annoying issue regularly – while debugging with android studio and a physicals device the device suddenly disconnect with no apparent reason.
sometime it gets into a loop of disconnect/reconnect for a few times
During the years I change PC, Devices, cables – but always at some point the problem persist.
I think there are many reason for this problem, including:
I tried to work with WIFI plugging, most of them didn’t work, the one who did work, solve the issue, but were ridiculously slow
I search the web many times and couldn’t find an answer that solve the issue for me, partly because there are many different reason for this, which makes each answer very specific.
Therefore I suggest that if any body find a solution for his specific case, please add it as an answer here for the the benefit of other.
Currently I found the following solution: after I bought many cables, I was finally able to find one that doesn’t disconnect as much (I actually borrowed it from my work…)
AND I also use Vysor, which project the android screen to my PC, so that I don’t have to move or touch the Physically device, which reduce the problem to almost never.
I also noticed that it happens more when the battery is 100% so I try to keep it below
SOLVED this with changing usb on pc from USB 3.0 port (blue type) to USB 2.0
For me only after disabling both