Application is waiting for the debugger to attach - android

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:
See target sdk
Restart eclipse and device
Update eclipse
Uninstall app from device and install again
I tried all this, but nothing helped. Kindly help me.

In my Nexus 7 Tablet running android 4.4.2
I solved this problem by going into
Settings
Developer options
Select Debug app
was selected , Select Nothing
Done!

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!

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!

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

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

I was having same problem with my emulator.
What i did is,
Close the emulator
Open AVD manager
Wipe Data from dropdown for the required emulator in AVD Manager. May be same thing work for devices also.

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>

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:
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.

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.

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.

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.

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.

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

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.

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!

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.

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.

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...

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

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

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

Related

How to resolve when Logcats stops working in Android Studio?

Logcat has stopped working for me again in Android Studio. Last time it happened I had to reinstall the IDE, and I want to avoid it again.
What I did for this to happen was changing...
Log.d("WRONG", "TEST");
to
Log.d("LOG", TEST");
and then changed the tag back to "WRONG" again. Now Logcat wont show any of my debug messages even if I remove WRONG from the filter when the app is running on my phone. The emulator still provides debug messages.
I already tried:
Checked if Android Device Monitor is active.
Restarting Logcat.
Change from Verbose to Debug and back to Verbose.
Unplugging the phone.
Restarting Android Studio.
Invalidate cache / Restart (in File menu).
Uninstalling the app.
Restarting the computer.
All of the above at the same time.
Changing phone.
Switching USB cable.
Opening Android Studio Manager. It bugged out and the log told me »java.io.IOException: The folder "C:\Users\Logga%20in.android\monitor-workspace.metadata" is read-only.«
[edit: tried even more solutions]
Using the terminal in Android Studio. Going to android sdk\platform-tools folder and typing adb kill-server followed by adb start-server.
opening Dalvik Debug Monitor through Command and checking the log there.
adding android:debuggable="true" to the manifest (under the application tag).
I'm using Android Studio 2.1 but the same thing happened when I was using 2.0b.
In my case in Android 2.2, for some reason, Firebase was selected by default in the dropdown box marked above. So logs didn't drop. I just needed to change it to No Filters
Hope this helps someone.
I finally got the log to start working again.
I did some updates in Android Studio, mostly just the repositories, but what I think was the real solution was to turn off my phone and have it turned off for about fifteen minutes. After that, the log started to work again.
try this,
Remove WRONG key word which is written in log cat search.
hope it will help you.
I selected no filter, cleared logcat buffer on device and then restarted the app and changed the filter back to "show only seleced application"
this ended up working for me :)
Reboot your PC. It happens to me once i restarted my PC worked fine.
To get a particular Logs from your application. You can use Create New Logcat Filter dialog which appears after selecting Edit Filter Configuration to create your own filter. And From filter option select My Tag
Mine stopped working twice in the past few weeks but it was not just log but the functionality I was implementing wouldn't work as well. I was running my code in an emulator. The solution was to plug in my phone and run it on my phone. It worked the first time on my phone. Only after it started working there did restarting the emulator work.

Eclipse connects to android debugger, but does not enter debug mode - what is wrong?

I'm failing to debug my Android app. I have set a breakpoint in the onCreate() method of an app, and starts the app in debug mode from Eclipse. The debugger successfully connects and the application and the device freezes at the point where I have set the breakpoint, but Eclipse does not give focus to the code line where it has paused.
The Run menu has all debug commands greyed out (step over, step into etc). I have opened the DDMS perspective and can see that the debugger is successfully connected. I can find my process there and stop it, and it gives the expected result on the phone. I have also tried all suggestions from this thread to no avail, but then again it tries to solve a different problem (not connecting).
Any suggestions?
more info: I have tried also the follwoing:
Uninstalling the app from the phone.
Rebooting the phone.
Restarting ADB.
Restarting eclipse
Rebooting the computer
Operating system is Windows 8. Eclipse version Juno. I have successfully debugged only days ago so there must be something I did that made this stop working.
Try going to the "Devices" View (Window > Show View > Devices).
In it, search for the process of your application, select it, and click at the button.
After that, run your application in the debug mode.

"Waiting for debugger to attach" showing even when not running in debug mode

My problem:
I ran upon an awkward problem as I was developing my application. As mentioned in the title, every time I install my application (in run mode, not debug!) at start-up the waiting for debugger to connect.. message appears for 1-2-3 seconds, and the application starts.
What I want:
What I would like is to be able to start the application without that message appearing (it only started appearing in the last few days, and I can't remember changing anything related to debugging).
What I've tried:
I have tried setting the android:debuggable="false" but if I do this the debugger never attaches and the message never disappears.
I have also tried after installing to disable USB Debugging, but still no results.
Even if I kill the application and wake it up through an external source (it uses Google's C2D Messaging Framework) it still tries to run in debug mode on wake-up.
I have developed several Android applications and never stumbled upon this. Why wouldn't I be able to start the application in RUN mode? Is there any other way to install the application on the device, without hitting the run button in Eclipse?
I can post code-snippets from the AndroidManifest or from other parts of the code if necessary, but as I already mentioned I wasn't getting this kind of weird behavior several days ago.
Make sure your java files dont have any break point and Restart the device every thing should be normal.
I was experience the same problems where my application was always being run in debug mode. Restarting the device did the trick for me.
and make sure you are using
right click on project-->>Run As -->> Android Application
For me the solution was turning off the USB debugging from my device settings, and then turning it on again!
Much quicker than restart the whole device.
I had the same problem using Android Studio. Restarting my cellphone worked for me!
1. Open setting in ur phone.
2. Go to developer options.(About Phone-> Developer Option).
3. Disable the Developer option and again enable the Developer Option.
4. Enable USB debugging and Install via USB.
Run this command and the issue will be resolved
adb shell am clear-debug-app
Check if the option waiting for debugger is actived.
Settings -> Developer options -> Wait for debugger.
I think this it is new from Jelly Bean.
I'm assuming this is in the emulator and not on a device. If it is a device, ignore the rest. :p
It sounds like you saved a snapshot of the emulator as the debugger was connecting.
To fix:
1) Go to the AVD control panel, click on the emulator that's affected and hit start
2) when the window pops up, de-select "Launch from snapshot" and leave "Save to Snapshot" selected
3) Start the emulator.
4) Close the emulator
5) On the AVD control panel again start the emulator
6) Check "Launch from snapshot" again
That should fix things up.
EDIT.
Sorry for the wasted space, I read too fast and missed you talking about trying disabling USB Debugging. I have run into the above situation I describe before so I'll leave this answer posted for those who come along who do have such an issue.
"Wait for debugger"in Developer options may have been set to wait your application.
Do check once that you placed breakpoints. Run app once and if you get the same message do debug as-> debug configuration-> select the app which you need to run and select always prompt to pick device.It will work for sure. It may be stupid, but i faced this problem for a long time and i tried this and this helped me. And if needed restart your device. Thanks
For me, I use Android Studio 2.1.2I, I click on Menu Run > Attach debugger to Android process
There is only 2 lines
__device_name
____app_name
I just select app_name(want to run) and click OK then miracle happens.
I had the same problem.
But restart my Device or clear the Breakpoints don't worked.
I tried :
Run --> Attach to Android Process.
Select your package and press OK.
and it works :)
There was so many adb processes running ,I kill them all and its start debugging
You can also set your Android App as Debugging-App
Settings --> Developer Options --> set Debuging-App
there you can choice your app
You might have added your app in Select app to be debugged on your phone. In Settings -> Developer Options -> Select app to be debugged
To resolve this, go to Select app to be debugged and click on No apps
Your manifest file may contain following permission
Just remove this permission
<uses-permission android:name="android.permission.SET_DEBUG_APP"/>

Can't disable auto debug

In the meantime of programming my app, it occurred, that even if i push the "run" button in eclipse (not the Debug one) the application starts in debug mode. Even if i pull out the Usb cable and start the app manually over the phone menu, it "waits for the debugger to attach"...
After deinstalling and reinstalling the manual start works well (w/o debugger) until I get an error. Afterwards always the debugger connects...
Can anyone explain me whats going on in "eclipses" or "androids" head here?
THX!
"Use the perspective DDMS , and run your app, and then , you will see the icon of debugging in the process of your app , uncheck it and it will work ;
if id didn't work , open the perspective Debug ,then, disable all the breakpoints , and it will work
"
or maybe you can try to delete the current run/debug cofiguration from eclipse proprties. Take a look on this
Tried a lot way on this but nothing works.
But I just fixed this by terminating the process with 8600 port through DDMS process list in devices view.
I had the same problem. Tried all the above and had no solution. I found my fix. Click on the Debug perspective button. Once it's selected, right click on it and then select 'reset'. This stopped the debugger from being called even when I was selecting "Run" and not "debug".
On further evaluation.. The following fixed my problem. The issue seems to be in the phone and not Eclipse.. this is a rare problem. I only found a hand full of people with same issue.
1) Uninstall app.
2) Hard reboot phone.
3) Reinstall app.
Now, eclipse won't go into debug mode even when all the preferences are set correctly and you select 'Run' and not 'debug'.
I had the same problem . Simply delete the app on the phone and reinstall it. Restart the device. It works for me.
I tried different ways without results:
delete all breakpoints.
restart Eclipse, DDMS

Why is the app waiting for the debugger when its not connected to computer?

It seems like every step I take in the Android world I run into problems.
Usually, I have my HTC Hero connected to the computer via USB and I launch the application either in debug mode or in normal mode.
So, the last time I ran the app in normal mode. Then I disconnect the device (I want to try to have it "free", not connected to computer) and I start the app from the menu. When I do that I get a popup saying "Application xxx is waiting for the debugger to attach" and there it stops and eventually dies.
Why is it waiting for the debugger, when the last time I ran the app (while connected) I didn't run it as Debug?
Edit 1
I might add this little weird fact:
If I do "Run" (green/white arrow) when the device is connected I still get a popup on the device saying "Application xxx is waiting for the debugger to attach".
Edit 2
Found this page. He restarted his device and that worked for me too. Stupid not to try that right away...
Just to close this question: I restarted the device, and that helped.
For me, the solution is to select "None" in "Developer Options"->"Debug"->"Choose debug application", though it already has "None" selected.
Seems like the device put a "need to debug" label on my app sometime before which is still there when I "Run" the app on the device using my IDE (or even launch the app manually when the device is not connected to PC), and re-select "None" removes the label. Don't know whether it's the case.
Restarting is more time taking, Easier way is that in the device, select "Developer Options" > “Select debug app” and select "Nothing".
Also, don't forget to go into your Android Settings under "Development Options" and unselect "Wait for Debugger"
You could also try removing the android:debuggable="true" from your AndroidManifest.xml file when you want to test the application by itself. Turning off development options in the preferences menu will help also.
I assume you are using Eclipse. Are you sure you are pressing the green circle with a white arrow and not the green bug button? Try closing the project, reconnecting the Hero, open the project and click the green/white arrow.
With your Edit1 - Try uninstalling the application from the Hero and try again.
With you Edit2 - I believe that will turn off all debugging capabilities. Good luck.
One more solution :)
In Android Studio 2.x follow these steps:-
1. Run the application:- Run Menu -> Run "app-name"
2. Attach debugger to process:- Run Menu -> Attach debugger to Android Process
"Wait for debugger"in Developer options may have been set with your application. Hence the application for debugger to attach.
Turn off Developer option and turn it back on.
Other than setting Select debug app to none, In android 9 and above (haven't check if exist in Android 8 but doesn't exist in Android 7) need to un-check Verify apps over USB
I recently upgraded my device from Android 7 to 9 and suddenly all my own apps (developed by me and are not signed) stopped working. disabling option mentioned above made them all work again.
I fixed it by turning off "Developer Options" in settings and then turning it back on again.

Categories

Resources