为什么应用程序在没有连接到计算机的情况下等待调试器?

似乎我在 Android 世界的每一步都会遇到问题。

通常,我有我的 HTC 英雄连接到计算机通过 USB 和我启动的应用程序,无论是在调试模式或在正常模式。

上次我在正常模式下运行应用程序。然后我断开设备(我想尝试让它“免费”,而不是连接到电脑) ,我从菜单启动应用程序。当我这样做的时候,我会看到一个弹出窗口,上面写着“ Applicationxxx 正在等待调试器附加”,然后它就会停止并最终死亡。

为什么它在等待调试器,上次我运行应用程序时(连接时)我没有以调试器的方式运行它?

编辑1

我要补充一个奇怪的事实:

如果我在设备连接时执行“ Run”(绿色/白色箭头) ,我仍然会在设备上看到一个弹出窗口,上面写着“ Application xxx is waiting for the debug to connect”。

编辑2

找到 这个页面。他重新启动了他的设备,这对我也有用。愚蠢的不尝试立即..。

41654 次浏览

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.

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.

Just to close this question: I restarted the device, and that helped.

Also, don't forget to go into your Android Settings under "Development Options" and unselect "Wait for Debugger"

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

One more solution :)

In Android Studio 2.x follow these steps:-

1. Run the application:- Run Menu -> Run "app-name"

Image to check how to run application

2. Attach debugger to process:- Run Menu -> Attach debugger to Android Process Image to check how to attach debugger to 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.