Reputation: 15476
UPDATE The supposed duplicate is a question on being stucking in "Waiting For Debugger" when executing Run, while this question is on being stucking in "Waiting For Debugger" when executing Debug, the steps to produce the problem is different, and the solution(s) are different as well.
Whenever I try to use Android Studio's Debug function, the Run status would always stuck at:
Launching application: com.astrotek.parashoot.debug/com.astrotek.ptpviewer.StarterActivity.
DEVICE SHELL COMMAND: am start -n "com.astrotek.parashoot.debug/com.astrotek.ptpviewer.StarterActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.astrotek.parashoot.debug/com.astrotek.ptpviewer.StarterActivity }
While the device (Samsung Galaxy S3 Android 4.3) I'm debugging would display
This has being the case from Android Studio 0.8.8 all the way to 1.0. And on the same computer I can perform debugging using Eclipse on the same device without any issues.
So the question is what can I do to make Android Studio debugging work?
Update: The same thing happens when debugging on Nexus 7 (2013) running Android 5.0; and testing on another machine rendered the same result. I can't be the only one encountering this issue :-/
Update: Opened a bounty since this issue is so annoying. Even re-installing the app doesn't solve. Nexus 5 running Cyano, Win7 64. The ADB log is telling:
8568-8568/it.myapp:myprocess W/ActivityThread﹕ Application it.myapp is waiting for the debugger on port 8100...
8568-8568/it.myapp:myprocess I/System.out﹕ Sending WAIT chunk
Also, I can't find an easy way to disconnect nor reset ADB connection in Android Studio.
Upvotes: 253
Views: 186955
Reputation: 1814
Solution for Android apps with C++ code (native code)
I have an Android app that has some C++ code and it seems that this puts a big load on the device - therefore timing out the debug connection. I solved it by using the Java Only
debug mode.
Edit Configurations...
Debugger Type
tabDebug Type
menu select Java only
.Upvotes: 1
Reputation: 371
For MAUI: you'll get an indefinite hang waiting for debugger to attach if you have both visual studio and android studio open at the same time.
Upvotes: 0
Reputation: 843
In my case manually deleting the previously installed app(package) solved the issue: adb shell pm list packages adb uninstall com.something.myapp.test
Upvotes: 1
Reputation: 41
Enable Developer Options: Ensure that Developer Options are enabled on your Android device. To enable Developer Options, go to Settings -> About Phone -> Tap on Build Number multiple times until you see a message confirming that Developer Options are enabled.
Select Debug App:
In Developer Options, find and select the "Select debug app option". Choose the app that is causing the debugger attachment issues.
When prompted to select the debugging app, choose the "Nothing" option.
Below are some screenshots :
Upvotes: 2
Reputation: 519
Toggling airplane mode on the device fixed it for me (without doing a reset)
Upvotes: 0
Reputation: 119
Using @twlkyao answer I entered in the terminal:
adb shell am clear-debug-app
And the response was:
adb.exe: more than one device/emulator
Then, taking a hint from @kudzai zishumba answer, I entered:
adb kill-server
And that cured my problem. I'm surmising that the debugger was attached to the emulator and also to my phone. It's my phone I'm wanting to run debug on, not the emulator.
Upvotes: 3
Reputation: 1231
For me the problem was having IntelliJ open at the same time as Android Studio. I was using IntelliJ for back-end development at the same time as Android Studio for app development. Even though I was not doing any mobile device work with IntelliJ, it broke debugging in Android Studio.
Solution: Shutdown IntelliJ when debugging with Android Studio.
Upvotes: 2
Reputation: 61
Change your time zone and region format. unfortunately, some regions are restricted.
Upvotes: 1
Reputation: 14628
Obviously is yet another Android Studio, or rather ADB bug.
Just use this command to disable it.
adb shell am clear-debug-app
OR
Ensure there is nothing to wait for, by automatic uninstall from Device before each test-run, using Gradle's uninstallAll
task, as mentioned in:
stackoverflow.com/Auto uninstall before install?
Upvotes: 289
Reputation: 369
Tried all the solutions given here but restarting my laptop worked for me.
Upvotes: 2
Reputation: 685
For me, the issue was: The Regional Format of Windows was ARABIC. I simply changed the regional format to English (United States) and the error has fixed.
Steps to fix:
Upvotes: 6
Reputation: 19
In my Linux Ubuntu Android Studio development environment, entirely deleting my configuration folder, ~/.config/Google/AndroidStudio2021.1, and restarting Android Studio was the only way to restore native debugging ability.
Upvotes: 0
Reputation: 1783
This also happens to me from time to time. Problem is that your app / device is configured to wait for debugger. In this case it is waiting for debugger before continuing execution of.
This was tested on Android emulator in android studio. Other phones might have this setting different. If you can not find app's settings in debug, reinstalling app might work too.
Upvotes: 4
Reputation: 303
Seems this is another Android Studio bug.
To prevent this problem return back to Android Studio v4.1.3 (4.1.1) or earlier and use Android Gradle Plugin Version
4.1+ and Gradle Version
6.6 . After this, android studio works fine. Say if this answer is useful, Thanks.
Upvotes: 0
Reputation: 758
After clicking on the run icon. If it is stuck waiting for a debugger means it is not attached to the app. You have to manually attach by clicking on Attach Debugger to Android process. It is on the right side of the run icon. I had focus this icon in linked image.
Updated Image for Attach Debugger to Android process Icon
Upvotes: 36
Reputation: 6938
Make sure that your Active Build Variant is debug
.
If you also want to make your release
variant APK debuggable then make a simple change in app level build.gradle
-
buildTypes {
release {
debuggable true
/*Your rest code*/
}
}
Upvotes: 1
Reputation: 441
I had the same problem. Restart my android phone device worked for me.
Upvotes: 7
Reputation: 3194
As for my case, running Android Studio Canary (preview release) along with the stable version was the problem. Running multiple instances of the same Android Studio flavor was OK, but mixing them often resulted in "Waiting For Debugger".
Upvotes: 3
Reputation: 1825
If all else fails, try "Clean Storage" via the app's System Settings.
Upvotes: -3
Reputation: 4127
It has happened to me that it stayed stuck in "Waiting for Debugger" when accidentally I tried to Debug a Release build, sometimes it warns that it is not a debug build and others it silently stucks in "Waiting for Debugger".
The solution is obviously to switch to Debug build
Upvotes: 0
Reputation: 1326
I faced this problem in android studio 3.0. Just restarted device solved.
Upvotes: 17
Reputation: 2271
I tried the top three rated answers but failed. After rebooting my mobile, the problem is solved. No more long "Waiting for Debugger".
Upvotes: 13
Reputation: 538
I just managed this problem, after several days of trying the above solutions. So I closed the emulator, run AVD manager and in device menu choose - "wipe data" So in next run I was free from stucked debugger.
Upvotes: 8
Reputation: 7711
Non of this solutions worked for me.
In my case was that I was debugging an App from Intellij IDEA and at the same time with Android Studio. By just closing the Intellij IDEA and removing the app I was debugging just fixed my problem.
Upvotes: 1
Reputation: 361
Sometime it's due to the fact that in the build.gradle configuration you have to set the node:
debug {
debuggable true
}
Change it back to false when you have to prepare the signed apk.
Regards
Upvotes: 0
Reputation: 732
Open Command prompt and go to android sdk>platform-tools> adb kill-server
press enter
and again adb start-server
press enter
Upvotes: 2
Reputation: 505
Got it fixed according this solution: https://youtrack.jetbrains.com/issue/IDEA-166153
I opened <project dir>/.idea/workspace.xml
replaced all the
<option name="DEBUGGER_TYPE" value="Auto" />
occurrences to
<option name="DEBUGGER_TYPE" value="Java" />
and restarted Android Studio
Upvotes: 2
Reputation: 488
This fixed it for me. Android Studio -> File -> Invalidate Caches & Restart...
Upvotes: 8