How to fix the “Waiting for debugger” error in Android Studio
For years, I’ve been seeing the “Waiting for debugger” dialog box when debugging an Android app. This dialog box is displayed until the debugger has attached to the process of the app you want to debug.
For some unknown and strange reasons, this dialog box would not go away and I was unable to continue the debugging session.
To fix this issue, I would have to restart my device or emulator, or even close and restart Android Studio. This was a heavy solution that was very frustrating and caused a lot of time loss.
Then I thought to do some research. I couldn’t be the only one who had encountered this issue, and I thought there might be a solution. Sure enough, I found a command-line solution.
You can continue without having to restart by typing the following command into the command line:
adb shell am clear-debug-app
This will clear ADB’s corrupted reference to your app, so you can start a new debugging session and see the infamous dialog box disappear.
This is a simple and effective solution to a frustrating problem. I hope it helps you out if you’re ever stuck in the same situation.