Android studio: USB debugging on Android P device gets stuck forever - android

Been facing this problem a lot of times, finally posting it on SO.
I start debugging my app with some breakpoints and it works properly for some sessions. Abruptly after some time, I will reach a breakpoint and the debugger shows Evalutaing... and it won't evaluate until eternity.
If I click resume or step buttons, the program won't proceed and the only way out is to disconnect and reconnect the device and start over.I am using latest stable Android studio.
Android 9 emulators work without issues. But I do get network connectivity issues on the P emulators. If I debug on Android O or lower devices, it works like charm.
Isn't anyone facing this issue? It's really frustrating when you don't have a device running lower Android version. Is downgrading to Oreo the only solution here? Any pointers will be appreciated.
Devices: Mi A2 (Android 9), Pixel 2 XL (Android 9).
Cables: Provided by both OEMs and tested to work perfectly in charging and data transfers.
Mode of debugging: USB
OS: MacOS Mojave and Ubuntu

Updating Android Studio to the next stable version fixed the issue. The debugger does not get stuck any more.

Related

Android Studio Disconnects From Physical Device

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 then adb 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!
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:
Bad/old cables
Erosion of the USB socket of the PC or the device
bugs in ADB/Android Studio/Android device
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

Android studio - avd crashes

i'm using android studio in windows server 2016 and have next problem: for work task i need to start android device emulation. On windows 10 emulator works fine, but same steps on windows server cause problem -"the emulator process for AVD_Pixel3A was killed". What should i do?
p.s: hyper-V components not installed, virtualization is accessable.
You will need to to have the H-visuals turned on.. Also check to see that you have HAX installed. Also be sure to turn on developer mode within the computer... I would also run the program on a physical android device to see if you get the same issue.
Also if none of these work you might have to check to see if the server runs the minimum requirements. If it does you may have to reinstall Android Studio. I had this happened to me the other day. I uninstalled and reinstalled Android Studio and it fixed the issue.

Mac is stuck and restart after android studio emulator is turned on

I am using a mac book pro with 16GB ram and core i9 processor. computer is working fine and when i start the android studio emulator suddenly internet is getting 100% slow and in few minutes mac is automatically restarting. but in the same computer emulator and android was working perfectly. once i encountered this issue, i completely reset my pc and reinstalled the operating system. however still it remains the same.
This issue was actually happening with the source code with some infinite loops. in a such situation, it's better to check the code properly.

Android Studio 3.0.1 does not find device

After I updted Android Studio to 3.0.1 my device was not found anymore (it worked perfectly before).
What I already tryed:
switching usb port and cable (should not be the problem anyway since it worked before)
turn my phone to PTP and back
checking if google usb drivers are installed in sdk
I dont know how I can get it back to work and I dont know if it might be a bug of Android Studio becuase everything worked before.
My Device - OnePlus 3T
My OS on desktop - Windows 10
I hope somebody can help me here.
Thanks!
install Universal ADB Driver
and configure your device with this tool first and then your device will be found by android studio

Android Studio ADB connection dropping wired attached device since 2.2 on Macintosh

All of these are new for me. It has to be one of them.
Android Studio 2.2 and Android 24.
Instant Run
Mac OS Sierra.
There doesn't seem to be any pattern. It occurs sometimes after 2 minutes, sometimes after 10.
I have three different devices, a 4.4, a 5.0 and a 6.0+. It's not the devices...it happens on all three. I've been using Studio on this Mac for well over a year, and have never seen this before.
The fix for this issue has been included in Android SDK Platform-tools 24.0.4
Please take a look to this link: https://code.google.com/p/android/issues/detail?id=223114 .
It is not a permanent solution, but since the problem is that ADB disconnects, it will reconnect again.

Categories

Resources