Android 设备在断点命中后几秒钟与调试器断开连接

发布于 2024-10-01 14:15:27 字数 124 浏览 0 评论 0原文

这已经困扰我几天了。每当我尝试使用断点调试除活动(后台服务、广播接收器、输入法)以外的任何内容时,我的断点都会正常命中,但大约五秒钟后,设备将终止进程并与调试器断开连接。没有足够的时间来收集任何有意义的信息,因此事实证明调试极其困难。

This has been plaguing me for a few days now. Any time I try to use a breakpoint to debug into anything other than an activity (background service, broadcast receiver, input method) my breakpoint will be hit normally, but then about five seconds later the device will terminate the process and disconnect from the debugger. It isn't enough time to gather any meaningful information so debugging has proven extremely difficult.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

呆头 2024-10-08 14:15:27

事实证明,在这个问题上设置赏金后,我终于能够弄清楚了......

对我来说,这是因为线程,当在后台线程中击中断点时,线程似乎超时了。为了解决这个问题,我更改了断点暂停应用程序的方式。我不只是暂停我们当前所在的线程,而是将其更改为暂停所有线程。

鼠标右键单击该断点,将其设置为全部暂停,也可以将其设置为默认,如下所示。

Well it turns out I was finally able to figure it out after setting a bounty on this question...

For me it was because of threading, it seems threads were timing out when a breakpoint has been hit in a background thread. To solve this, I changed how the breakpoint suspends the app. Instead of just suspending the thread we're currently in I changed it to suspend all instead.

Right mouse click the break point and set it to suspend all, you can also set this as default as shown below.

Set suspend to all

少年亿悲伤 2024-10-08 14:15:27

我刚刚遇到了同样的问题

,对我来说,当我的手机(中兴刀片)接到电话时,我正在调试。我接听了电话,当我之后再次返回调试时,我发现无论我在某一特定行上放置什么代码(可能是我在接到电话时暂停/有断点的那一行),活动都会崩溃(无声地/没有错误消息)当它到达该行时。

经过一番混乱后,我发现如果我在有问题的行上添加和删除了一个断点,然后以不同的方法添加了另一个断点,那么新断点会暂停,并且在运行应用程序一次后,整个事情都很好

I have just had the same problem

What happened for me was that I was in the middle of debugging when my phone (a ZTE blade) recieved a call. I took the call and when I came back to debugging again afterwards, I found that no matter what code I put on one particular line (probably the one where I had paused / had a break point when I recieved the call), the activity crashed (silently / without error message) when it hit that line.

After some messing around, I found if I added and removed a breakpoint on the offending line and added another in a different method later on, that the new breakpoint paused and after running the app through once, the whole thing was fine

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文