65

I,m working in eclipse to develop an android app and when i tried to debugged on my samsung tab, i got the following msg on its screen "Waiting for debugger" and beneath it was written "application xxx is waiting for the debugger to attach ", I did some search and found to:

  1. See target sdk

  2. Restart eclipse and device

  3. Update eclipse

  4. Uninstall app from device and install again

    I tried all this, but nothing helped. Kindly help me.

adelarsq
  • 3,718
  • 4
  • 37
  • 47
saadsaf
  • 1,421
  • 1
  • 17
  • 28
  • I have the same problem and it doesn´t seem to be related to the device. I tried it on my Galaxy S2 and also in the emulator, both the same. Restart doesn´t have any effect at all. I´m using android studio – Marian Klühspies Feb 20 '14 at 16:16
  • 1
    I had a similar problem this moment: I always got the "Waiting for debugger" message, even when installing a signed apk of my app with detached USB. A restart of the device "fixed" the problem. – Hyndrix Mar 08 '14 at 12:29
  • Possible duplicate of [How to resolve "Waiting for Debugger" message?](http://stackoverflow.com/questions/4375375/how-to-resolve-waiting-for-debugger-message) – nobody Jan 17 '16 at 15:46

22 Answers22

156

In my Nexus 7 Tablet running android 4.4.2 I solved this problem by going into

  1. Settings
  2. Developer options
  3. Select Debug app
  4. was selected , Select Nothing

Done!

Menelaos Kotsollaris
  • 5,776
  • 9
  • 54
  • 68
silver1991
  • 1,597
  • 1
  • 9
  • 6
  • 4
    In my case on Lenovo tab I did exactly opposite. There was selected nothing, but I selected needed application. And this did the trick – Leo DroidCoder Aug 09 '16 at 09:11
  • This works perfectly. Except I selected the pp that i am trying to run. I don't know why the problem arose though. I am trying integration of OAuth in my application, and at first it wass not giving me trouble but then it was getting connected fine when i tried via Android Studio, but was not working when I tried opening the app from device itself. If anyone knows why this happens please let me know. I can't show you logs as I encounter this problem when device is disconnected from computer – hyperCoder Sep 30 '18 at 23:18
  • time saver!, thnxs – MAhipal Singh Jun 02 '23 at 14:02
41

Sometimes "force to close and open again" doesn´t work, so this problem could be present when the application is currently in debug and is selected to be debugged, then from your device go to:

Settings -> Developer options -> Select app to be debugged -> Select Nothing

or when the application is supossed to being in "debug mode" but is not selected as be debugged :

Settings -> Developer options -> Select app to be debugged -> Select the application!

Jorgesys
  • 124,308
  • 23
  • 334
  • 268
17

I had same issue. Adding permission didn't help me, because Eclipse automatically enables debugging when it runs in debug mode.

Check your device setting whether "Wait for debugger" is unchecked under "Developer Options".

Also I tried closing and restarting Eclipse, and finally it worked!

I'm still figuring out what the real problem is, but hope this helps!

Nari Kim Shin
  • 2,459
  • 1
  • 25
  • 33
  • I have checked that option, because the `Log` is not showing the messages in the Android Monitor, but it seems that the debugger is never attached. – JCarlosR Jul 03 '17 at 17:09
13

Restarting Eclipse is the only solution which works every time for me.

toto_tata
  • 14,526
  • 27
  • 108
  • 198
  • This works for me as well (on Android Studio). AS somehow gets confused and isn't able to see any debuggable processes on the device. Restarting AS fixes this. – Jeremy Jul 16 '15 at 05:06
9

Go to Settings->Developer options. And then just turn off and on check box right to the Developer options title.

Also toggle USB Debugging again.

Worked for me

vbevans94
  • 1,500
  • 1
  • 16
  • 15
4

I was having same problem with my emulator. What i did is,

  1. Close the emulator

  2. Open AVD manager

  3. Wipe Data from dropdown for the required emulator in AVD Manager. May be same thing work for devices also.

Mandeep Singh
  • 857
  • 8
  • 13
3

This has been asked before. It is uncommon, but some devices need an extra permission(flag) to let the debugger attach!

So open your androidManifest.xml and add this permission:

<uses-permission android:name="android.permission.SET_DEBUG_APP"></uses-permission>
bofredo
  • 2,348
  • 6
  • 32
  • 51
2

Another reason for this dialog to hang there is when you have breakpoints in different processes of your components (application / activity etc...).

For example:
If you have a breakpoint in an activity that runs on a different process than your main application you will see this dialog until you attach the debugger to the process manually.
For android studio it will be using the icon in the middle:

enter image description here

The intuitive reason for this will be that when you run in a debug mode the debugger is attached to your main application process and not to all your other processes, thus you need to specify manually to which process you want to attach your debugger.

MikeL
  • 5,385
  • 42
  • 41
1

I had this problem when I press only F11 to Run.

Pressing F11 does debug. In order to run, press Ctrl+F11.

I haven't ever seen this problem after do like this.

OhBeWise
  • 5,350
  • 3
  • 32
  • 60
1

I ran into this issue on Android Studio 2.0 with a Nexus 6 running 6.0.1.

I tried most of the suggestions above and finally fixed it by restarting both Android Studio and my Nexus 6.

josef
  • 29
  • 1
1

I had this same issue and eventually found that in AndroidManifest.xml the Application element had the following attribute:

 android:debuggable="false"

I changed this to

 android:debuggable="true" 

And the debugging then worked correctly.

BruceHill
  • 6,954
  • 8
  • 62
  • 114
1

I have tried the following to no avail:

  • Restart the Android device.
  • Turn Developer options off/on under the Settings of the Android device.
  • Disable/enable USB debugging.
  • Restart Android Studio.

It started working after: Android Studio > File > Invalidate Caches/Restart...

Hong
  • 17,643
  • 21
  • 81
  • 142
0

I had the same problem with my Samsung S4 mini: after hibernating my pc with running eclipse, my phone couldn't connect with the debugger anymore. Restarting phone and eclipse didn't work.

I found, that my eclipse "disabled" the debugger in the android devices view: Window menu -> Show View -> Other -> Android -> Devices (also called DDMS view)

There was a red bug in front of my device. I enabled debugging by pushing the green bug button and now debugging works fine. This also works, if there is no bug in front of your debugging device.

partisan
  • 42
  • 8
0

It's also good to investigate port 8700 (the DDMS "base port", a port forwarder). When TCPView shows that this port is kept by process "", it's impossible to connect to ADB and debug. This process can't be killed nor terminated in TCPView. After logging out of Windows and logging in again, this port is free again. After starting AndroidStudio/IntelliJIdea this port is owned by process "idea64.exe" and its possible to debug.

When application crashes and AndroidStudio is restarted without stopping debugger (which also detaches from ADB), it may happen that port 8700 is not released, blocked by process "".

TCPView: https://technet.microsoft.com/en-us/library/bb897437.aspx http://developer.android.com/tools/debugging/ddms.html

greenmarker
  • 1,599
  • 1
  • 21
  • 29
0

I got this error even when the USB was unplugged, and the app wouldn't start.

The only thing that worked for me was restarting the Android device.

live-love
  • 48,840
  • 22
  • 240
  • 204
0

I found this simple solution to it. Just click on the debug panel tab at the lower potion of your eclipse or wherever it is. Tada!! It works! It seems eclipse is getting old it needs a slight nudge. Works every time for me!

Utsav Gupta
  • 3,785
  • 5
  • 30
  • 52
0

I got stuck with this when I tried to debug from IntelliJ cause I had both IntelliJ and Android Studio open. Even if there where no debug-process going on in Android Studio, I was able to launch debug from IntelliJ after I closed Android Studio.

superodde
  • 131
  • 1
  • 3
0

Restarted the Android Studio but that didn't help. Unplugged the device from USB and plugged it back in which did the trick for me, no changes needed in Developer options in the phone settings.

tariq101
  • 127
  • 2
  • 6
0

For me it was when two different Android Studio were launched simultaneously

Vladimir Berezkin
  • 3,580
  • 4
  • 27
  • 33
0

Just run ./gradlew clean and see this error are wiped out

-1

It's normal message when you debugging your application. Just wait for several seconds and app will start.

Autocrab
  • 3,474
  • 1
  • 15
  • 15
-1

Simply force to close then, open it again :)

Edited: force to close the application, and then go to menu and start the application by clicking on the apps icon

Ootvia
  • 7
  • 3