如何解决“等待调试器”消息?

我用 SDK 2.2将 HTC Comet 连接到 Eclipse。我做了一个调试构建-应用程序不运行; 虽然它得到安装在设备上。在设备上,我会在 Comet 屏幕上看到这个消息框

等待调试器
Application HunyDew (process com.airvine.HunyDew)正在等待调试器附加。
[迫近]

而在 Eclipse 控制台中,我得到了这些消息集

[2010-12-07 01:42:29 - hunydewprj] Android Launch!
[2010-12-07 01:42:29 - hunydewprj] adb is running normally.
[2010-12-07 01:42:29 - hunydewprj] Performing com.airvine.hunydew.HunyDewAAStartsHere activity launch
[2010-12-07 01:42:47 - hunydewprj] Application already deployed. No need to reinstall.
[2010-12-07 01:42:47 - hunydewprj] Starting activity com.airvine.hunydew.HunyDewAAStartsHere on device 308730C861BC
[2010-12-07 01:42:49 - hunydewprj] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.airvine.hunydew/.HunyDewAAStartsHere }
[2010-12-07 01:42:49 - hunydewprj] Attempting to connect debugger to 'com.airvine.hunydew' on port 8601
[2010-12-07 01:43:09 - hunydewprj] Launch error: Failed to connect to remote VM. Connection timed out.

应用程序在模拟器中运行良好-请帮助-我在这里遗漏了什么?有什么提示或建议吗?谢谢

150442 次浏览

Some devices will only let the debugger attach if the application has the android.permission.SET_DEBUG_APP permission set in its manifest file:

<manifest>
<uses-permission android:name="android.permission.SET_DEBUG_APP"></uses-permission>
</manifest>

I get this if I switch the usb cable to a difference port on my PC, odd but it works when I switch it back again. Also I think I've got this when there's been another device or emulator running at the same time, or two instances of Eclipse open.

Not sure if this is what you are looking for, but try putting:

android:debuggable="true"

in the application tag in the AndroidManifest.xml

If your development environment is Windows make sure the USB drivers are correctly installed.

One way to ensure that the USB drivers are installed correctly is to get the PDANet Windows installer and let it install the USB drivers.

You can find the PDANet page here.

I would try to connect to the phone with ddms on its own without Eclipse. You might be running an emulator inside eclipse that you dont see or have some other problems with Eclipse.

Just run ddms from a command prompt and see if the device appears and you can connect to it.

You can also see if appears when you run adb devices and see that your phone is listed (and maybve something else..)

I ran into this problem today. After spending most of the day trying to fix it, the only thing that ended up working was to create a new workspace and import my project into it. I hope this helps someone avoid all the trouble that I went through.

I got the same problem, I know I wasn't running any other instances, and I could see it with adb devices. I just did a restart of eclipse and it worked.

My solution is to use the Dalvik Debug Monitor. Sometimes there is a red or green bug beside a process. Click on the device you're trying to load to. Select the Actions tab and reset adb. This usually attaches the debugger for me. I find that doing debugging through this Monitor works better for me than using the Android Eclipse plugin Logcat.

I end up going into "Debug" perspective.

Then in the "Debug" frame, there are debug list or running list.

You have to decide which one is your current one that has this problem (Waiting for debug...)

Then do right-click and choose "Terminate and Remove".

Then you try to run again. And that warning box will be gone.

I've got this problem for long that I cant get my android emulator or device connect to the debugger while both the console and the emulator were displaying waiting for connecting to the debugger.

And configuration for debug inside eclipse also confused me so much before, but today, i got this problem solved, by the following steps:

When you want to debug a android project, for instance, mypro. you would right click on it in the "Package Explorer". Then choose "Debug as"-->"Android Application".

Then the emulator might stop at the "Waiting for connecting to debugger"(or something else similar to this).

Then you need to connect to the debugger yourself by click "DDMS" to open the DDMS perspective, and click "Devices" tab.

Then you can see a list of processes that are running on your emulator or device.

Double click on the one which you are debugging, then change to the Debug perspective, you can see the debugger is connected and you could debug your program. That's how I solved this problem.

By the way, my OS is Win7 32-bit. Eclipse's version is Helios Service Release 2. Android SDK is rev. 16 and platform-tools' 10.

Update.

I found that it is the problem of my TCP/IP configuration. The debugger can't be connected when i assign a static IP address(for access to internet).

So every time when the debugger is unable to connect, I always do the following steps:

1.close current eclipse window.

2.change the config of IP address to dynamic, it means getting a IP address by DHCP.

3.open up the eclipse again.

then the debugger is able to be connected. I thought it might be a issue of the internal mechanism of java debugger which is using socket connection.

I had the same issue, fixed it by explicitly selecting desired device in debug configuration. Unfortunately, even after that log sometimes stops when debugger tries to connect. In this case in DDMS perspective find the desired process. It will be highlighted with green bug. Click stop and then debug it again.

Rebooting the PC was the only thing that worked for me. It worked when I had this problem with an Android 2.2 phone, and also an Android 3.1 tablet.

Closing the emulator and closing eclipse. Reopening Eclipse and starting the simulator worked for me.

The key thing to look for is in the Devices pane of Eclipse. If you start the emulator or device and it shows up in the device name list but says [null] and no running processes show beneath it, then it won't work correctly with loading your app into it.

If the name of the device comes up and is Online then things seem to work smoothly.

Don't know why it doesn't work out all the time though.

I also enounter this problem. In my environment, I use a tomcat as server and android as client. I found, If tomcat is started, this error " Launch error: Failed to connect to remote VM. Connection timed out." will occur. If tomcat is not run, adb works well.

I tried all the solutions above, it fixes the issue sometimes, but still from time to time I happened to get stuck with the "Waiting for the debugger to attach" message box.

The final solution in my case was to unplug all the Android devices but the one I want to debug on. I don't know which one is the culprit: the Nexus 7 running JB 4.2, the HTC One X running ICS, the HTC Desire S running Gingerbread, or the combintation of the 3, but as soon as I only have one device plugged in, it runs smooth as silk.

For those getting this annoying behavior in 4.2.2 you have to un-check the setting for "wait for debugger" in the developer options. Of course, those options were hidden by Google, and you have to do a sneaky trick to get them to show back up. I had set them before they disappeared, and couldn't for the life of me find them again.

This page explains the procedure

I used Task Manager to kill adb.exe to solve this problem. Adb.exe will automatically start after being killed.

Killing adb.exe has solved a lot of problems related to debug and emulators for me so far.

For Android Studio users I encountered this problem first time while trying to run a bare bone project just after updating my jdk location. So I stumbled across this post. In my case simple Build->Clean Project did the job.

Running Android Studio, I ran into this problem and after trying various remedies restarting Android Studio is what appeared to fix the problem.

I was also having the same problem when using Android Studio and GenyMotion. I am able to solve this problem by pausing the program and resuming it again after "Waiting for debugger" message is shown. It may work while using other IDEs and emulators as well.enter image description here

Android Studio 1.2.2 on Mac OS 10.10 Same problem as others have reported. I closed Android Studio, then checked from command line in terminal:

ps -efw|grep -i android

This reported a java process (.gradle/daemon) associated with Android Studio. I killed this process, restarted Android Studio, and the problem went away.

disable you developer option in your phone.

Settings > Developer option > Disable

This worked for me, when i tried to use my application without debugging it.

In my case, the problem is caused by adb connected with another device.

If several devices are connected in PC, remove other devices except required one.

What solved the problem for me was going to: "Run"->"Attach Debugger to Android process" and then select your process.

You do this in Android Studio.

This may be old, but for Genymotion's latest update 2.7.1, go to Developer options, if in case you dont know how to open that option, go to About phone and click Build number few times and Developer options will be enabled. Turn ON Developer option, check USB debugging.

Tested on Genymotion 4.4 and up. Weird solution eh ? But definitely works. Hope it helps. Happy codings.

In Debug mode Android Studio connects to your Device via socket(:8600). Somehow your socket connection is choked and thus not responding to incoming connections.

Restart Android Studio and your problem will be resolved

The Dialog Waiting for Debugger is shown if you are building a debug application or somewhere in your source code, you called Debug.waitingForDebugger();

Inside Android Studio 2.0 and above, there is an option of Attach Debugger to Android Process. It is the last menu item in the Run menu.

Screen shot of Run menu options in Android Studio

I solved this issue this way:

Go to Run menu ====> click on Edit Configurations ====> Micellaneous and finaly uncheck the option Skip installation if APK has not changed

enter image description here

enter image description here

Have read alot about this and the only solution that worked for me was to create a new project and then copy old project back into it.

"Wait for debugger"in Developer options may have been set to wait your application.Please clear that option and application should run normally.

Rebooting the phone was the solution for me.