32

I have been working on a project, and when I run the project in android studio it had been running correct and when I ran in debug mode it ran correctly.

All of a sudden, when I try to run the project normally, it pops up on the device waiting for debugger

and in the logcat I get this:

02-07 10:38:46.444    3968-3968/com.geog.test D/dalvikvm﹕ Late-enabling CheckJNI
02-07 10:38:46.784    3968-3968/com.geog.test W/ActivityThread﹕ Application com.geog.visitdub is waiting for the debugger on port 8100...
02-07 10:38:46.804    3968-3968/com.geog.test I/System.out﹕ Sending WAIT chunk

and it goes no further. I don't know why this is happening, there is no debug command in the manifest, I have killed the adb and restarted as I did with android studio.

It's a real pain in the a*** as I can't run the app without going through debug mode. If anyone has any ideas I'd like to hear them

Thanks

DJ-DOO
  • 4,545
  • 15
  • 58
  • 98

8 Answers8

47

Restart your Android Device once and also check there should not be any breakpoints in your java classes.

Piyush Agarwal
  • 25,608
  • 8
  • 98
  • 111
5

The above suggestions were too invasive for me so I digged a little more into it. The following solution works for me in android studio:

  • Start debugging. (You'll get the wait chunk message here)
  • Select the Debug pane with the bug icon.
  • press the small cross at the side menu.
  • press "Force close" on your device.
  • Restart debugging.
3

In my case, there was an AsyncTask whose doInBackground() method called android.os.Debug.waitForDebugger(), and this was being picked up even in run mode. Disabling the line fixed it. Restarting the device didn't help.

David Lord
  • 628
  • 10
  • 29
  • Don't know _why_, as the [docs](https://developer.android.com/reference/android/os/Debug.html#waitForDebugger%28%29) don't indicate it should block a normal run, so would appreciate any suggestions. – David Lord Jul 06 '16 at 16:59
2

try this , always work :

1 - close Android Studio and any other IDE you have opened (maybe you have Eclipse also running?) and emulator instances;

2 - remove USB cable from PC and restart your phone if you use one ;

3 - run adb kill-server from console;

4 - open Android Studio;

5 - click on run/debug;

6 - when the window to select the device appears, attach your device to USB and USB to your computer;

mhdjazmati
  • 4,152
  • 1
  • 26
  • 37
2

In my case it was a service to which I had added android.os.Debug.waitForDebugger(). The service was in a separate process by defining in the manifest android:process=":sepprocess"; after removing this line (such that the service is in the same process as the main activity), debugging started to work in the service and I did not experience the

    I/System.out﹕ Sending WAIT chunk 

anymore.

Stefan Verhagen
  • 303
  • 3
  • 7
2

First clear all the break points from your project using ctrl+shift+F8 for windows or for mac cmd+shift+F8. Restart your android device. Then run

Mamatha G
  • 21
  • 2
1

In my case, there are multiple debuggers. I have native code running in my app.

I cleared it by selecting the Debugger and Process from Run->Attach Debugger to Process

Arun Shankar
  • 2,603
  • 2
  • 26
  • 36
0

I deleted the emulator and recreated. It worked for me.

Emre AYDIN
  • 724
  • 8
  • 10