ANR keyDispatchingTimedOut

时间:2013-01-23 07:10:18

标签: android multithreading

当我开始我的活动时,我收到一个ANR错误。我没有得到如何修复,我认为这个错误是因为事件。

这是错误:

    01-23 12:29:29.594: E/ActivityManager(147): ANR in com.vxoom.qit.login (com.vxoom.qit.login/.UpdateTokenList)
01-23 12:29:29.594: E/ActivityManager(147): Reason: keyDispatchingTimedOut
01-23 12:29:29.594: E/ActivityManager(147): Load: 2.36 / 2.14 / 2.09
01-23 12:29:29.594: E/ActivityManager(147): CPU usage from 24818ms to 0ms ago with 99% awake:
01-23 12:29:29.594: E/ActivityManager(147):   3.3% 3575/com.vxoom.qit.login: 2.9% user + 0.3% kernel / faults: 939 minor
01-23 12:29:29.594: E/ActivityManager(147):   2% 3/ksoftirqd/0: 0% user + 2% kernel
01-23 12:29:29.594: E/ActivityManager(147):   0.6% 477/RTKTHREAD: 0% user + 0.6% kernel
01-23 12:29:29.594: E/ActivityManager(147):   0.3% 214/com.android.systemui: 0.2% user + 0% kernel / faults: 10 minor
01-23 12:29:29.594: E/ActivityManager(147):   0.2% 147/system_server: 0.2% user + 0% kernel / faults: 23 minor
01-23 12:29:29.594: E/ActivityManager(147):   0.1% 85/surfaceflinger: 0% user + 0% kernel
01-23 12:29:29.594: E/ActivityManager(147):   0% 133/adbd: 0% user + 0% kernel
01-23 12:29:29.594: E/ActivityManager(147):   0% 2611/kworker/u:0: 0% user + 0% kernel
01-23 12:29:29.594: E/ActivityManager(147):   0% 3450/kworker/u:1: 0% user + 0% kernel
01-23 12:29:29.594: E/ActivityManager(147): 7.4% TOTAL: 3.5% user + 3.5% kernel + 0.2% softirq
01-23 12:29:29.594: E/ActivityManager(147): CPU usage from 354ms to 868ms later:
01-23 12:29:29.594: E/ActivityManager(147):   2.7% 477/RTKTHREAD: 0% user + 2.7% kernel
01-23 12:29:29.594: E/ActivityManager(147):   1.2% 3/ksoftirqd/0: 0% user + 1.2% kernel
01-23 12:29:29.594: E/ActivityManager(147):   1.9% 147/system_server: 0% user + 1.9% kernel
01-23 12:29:29.594: E/ActivityManager(147):     1.9% 179/InputDispatcher: 0% user + 1.9% kernel
01-23 12:29:29.594: E/ActivityManager(147): 7.6% TOTAL: 0% user + 7.6% kernel

1 个答案:

答案 0 :(得分:0)

不,这很可能是你的错。因为某些东西在UI线程中正在进行工作,所以无法分派触摸事件。这就是抛出异常的原因。

在手机设置中打开开发人员选项并启用严格模式(可能命名不同),它将帮助您在主线程中查找长时间运行的操作。

什么触发ANR:
http://developer.android.com/training/articles/perf-anr.html