Android 为什么应用程序在未连接到计算机时等待调试器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2031070/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why is the app waiting for the debugger when its not connected to computer?
提问by Ted
It seems like every step I take in the Android world I run into problems.
似乎我在 Android 世界中采取的每一步都遇到了问题。
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.
通常,我通过 USB 将 HTC Hero 连接到计算机,然后在调试模式或正常模式下启动应用程序。
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.
所以,我最后一次在正常模式下运行应用程序。然后我断开设备(我想尝试让它“免费”,而不是连接到计算机)并从菜单启动应用程序。当我这样做时,我收到一个弹出窗口,说“应用程序 xxx 正在等待调试器附加”,然后它停止并最终死亡。
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
编辑 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".
如果我在连接设备时执行“运行”(绿色/白色箭头),我仍然会在设备上弹出一个提示“应用程序 xxx 正在等待调试器连接”。
Edit 2
编辑 2
Found thispage. He restarted his device and that worked for me too. Stupid not to try that right away...
找到了这个页面。他重新启动了他的设备,这对我也有效。愚蠢的不立即尝试...
回答by Ted
Just to close this question: I restarted the device, and that helped.
只是为了结束这个问题:我重新启动了设备,这有帮助。
回答by codeno
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.
对我来说,解决方案是在“开发人员选项”->“调试”->“选择调试应用程序”中选择“无”,尽管它已经选择了“无”。似乎设备在某个时候在我的应用程序上放置了“需要调试”标签,当我使用 IDE 在设备上“运行”应用程序时,该标签仍然存在(甚至在设备未连接到 PC 时手动启动应用程序) ,并重新选择“无”删除标签。不知道是不是这样。
回答by Selfx Aadhyant
Restarting is more time taking, Easier way is that in the device, select "Developer Options" > “Select debug app” and select "Nothing".
重启需要更多时间,更简单的方法是在设备中选择“开发者选项”>“选择调试应用程序”并选择“无”。
回答by Lars
Also, don't forget to go into your Android Settings under "Development Options" and unselect "Wait for Debugger"
另外,不要忘记进入“开发选项”下的 Android 设置并取消选择“等待调试器”
回答by Austyn Mahoney
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.
android:debuggable="true"
当您想单独测试应用程序时,您也可以尝试从 AndroidManifest.xml 文件中删除。在首选项菜单中关闭开发选项也会有所帮助。
回答by fupsduck
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.
我假设您正在使用 Eclipse。您确定您按下的是带有白色箭头的绿色圆圈而不是绿色的 bug 按钮吗?尝试关闭项目,重新连接 Hero,打开项目并单击绿色/白色箭头。
With your Edit1 - Try uninstalling the application from the Hero and try again.
使用您的 Edit1 - 尝试从 Hero 卸载应用程序,然后重试。
With you Edit2 - I believe that will turn off all debugging capabilities. Good luck.
和你一起 Edit2 - 我相信这会关闭所有调试功能。祝你好运。
回答by fupsduck
One more solution :)
另一种解决方案:)
In Android Studio 2.x follow these steps:-
在 Android Studio 2.x 中,请按照以下步骤操作:-
1. Run the application:-Run Menu -> Run "app-name"
1.运行应用程序:-运行菜单->运行“app-name”
2. Attach debugger to process:-Run Menu -> Attach debugger to Android Process
2. 将调试器附加到进程:-运行菜单 -> 将调试器附加到 Android 进程
回答by Shinoo Goyal
"Wait for debugger"in Developer options may have been set with your application. Hence the application for debugger to attach.
开发人员选项中的“等待调试器”可能已与您的应用程序一起设置。因此,调试器的应用程序要附加。