Android 应用程序仅在 Eclipse 调试时因 SIGABRT Signal 6 崩溃 [英] Android app crashes with SIGABRT Signal 6 only while Eclipse debugging

查看:47
本文介绍了Android 应用程序仅在 Eclipse 调试时因 SIGABRT Signal 6 崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,它可以在没有连接调试器的设备上完美运行.但是,我在 Eclipse 中调试时遇到了一个问题:

I have an app that runs perfectly fine on a device without a debugger attached. However, I have a problem when debugging in Eclipse:

当主线程挂起大约 10 秒或更长时间时(例如在遇到断点后),主线程抛出一个 SIGABRT,显然来自 libc.

我能想到的唯一解释是主线程上的消息队列在没有被轮询时被来自另一个线程的消息溢出.但是,当主线程暂停时,我没有看到堆在增长.此外,虽然我的应用在所有服务、内容提供者、广播接收器、http 和地图工作线程等之间有大约 20 个线程,但我真的想不出任何过多消息的来源.

The only explanation I could think of is that the message queue on the main thread, when not being polled, is overflowing with messages coming from another thread. However, I don't see the heap growing when the main thread is suspended. Moreover, while my app has about 20 threads between all services, content providers, broadcast receivers, http and map worker threads, etc., I can't really think of a source of any excessive messages.

所以我的问题是:我该如何解决这个问题?我可以使用哪些工具以及如何在调试器中暂停时查找导致我的应用崩溃的原因?

So my question is: How do I fix this problem? What tools can I use and how do I go about finding what is causing my app to crash while sitting suspended in the debugger?

编辑 1:

logcat 中唯一的东西是:

The only thing in logcat is:

02-05 22:23:54.861: I/dalvikvm(26795): threadid=3: reacting to signal 3
02-05 22:23:54.901: D/dalvikvm(26795): threadid=1: still suspended after undo (sc=1 dc=1)
02-05 22:23:54.901: I/dalvikvm(26795): Wrote stack traces to '/data/anr/traces.txt'
02-05 22:23:58.905: A/libc(26795): Fatal signal 6 (SIGABRT) at 0x000002f5 (code=0), thread 26795 (om.myapp)

编辑 2:

进一步调查让我相信是 android 故意杀死我的进程,因为它错误地认为 UI 线程已挂起.问题不在我的应用程序中.所以现在我的问题是:如何阻止 Android 在调试时杀死我的进程?

Further investigation leads me to believe it is android intentionally killing my process because it mistakenly thinks the UI thread is hung. The problem is NOT in my app. So now my question is: How do I stop Android from killing my process while debugging?

推荐答案

android 故意杀死进程,因为它认为 UI 线程挂了,所以它是 ANR 对的.出于调试目的,您可以,

android intentionally kills the process because it thinks the UI thread is hung, so its a ANR right. for debugging purposes you can,

转到设置"->开发者选项"并选中显示所有 ANR".

Go to Settings -> Developer options and check Show all ANRs.

这将为在后台运行的应用程序显示一个应用程序无响应对话框.您可以单击对话框中的等待"按钮以防止系统在调试器连接之前终止您的进程.请注意,对于在前台运行的应用程序,对话框会自动打开.对于后台应用程序,您必须启用此选项

This will show an App Not Responding dialog for apps running in the background. You can click the Wait button in the dialog to prevent the system from killing your process until the debugger attaches. Note that the dialog is opened automatically for apps running in the foreground. For background apps, you have to enable this option

这篇关于Android 应用程序仅在 Eclipse 调试时因 SIGABRT Signal 6 崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆