1

运行崩溃的应用程序时,我得到了这些堆栈跟踪。我知道它必须与“ANR keyDispatchingTimedOut”有关。我是 Android 开发的新手,我需要一些帮助来阅读跟踪。

DALVIK THREADS:
"main" prio=5 tid=1 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x40028ae0 self=0xcd58
  | sysTid=7787 nice=0 sched=0/0 cgrp=default handle=-1345021904
  | schedstat=( 12266998315 6628478984 2116 )
  at android.database.sqlite.SQLiteQuery.native_fill_window(Native Method)
  at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:70)
  at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:299)
  at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:280)
  at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:171)
  at android.database.AbstractCursor.moveToFirst(AbstractCursor.java:248)
  at george.android.eortologioAlpha.EortologioAlpha.statheresPlhrhsGiortes(EortologioAlpha.java:171)
  at george.android.eortologioAlpha.EortologioAlpha.giortazei(EortologioAlpha.java:265)
  at george.android.eortologioAlpha.EortologioAlpha.eortazomenhEpafh(EortologioAlpha.java:281)
  at george.android.eortologioAlpha.EortologioAlpha.onCreate(EortologioAlpha.java:474)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1065)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2745)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2797)
  at android.app.ActivityThread.access$2300(ActivityThread.java:135)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2132)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:143)
  at android.app.ActivityThread.main(ActivityThread.java:4914)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  at dalvik.system.NativeStart.main(Native Method)

"Binder Thread #2" prio=5 tid=5 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x447cdb78 self=0x130b40
  | sysTid=7791 nice=0 sched=0/0 cgrp=default handle=1248000
  | schedstat=( 6164551 6774901 9 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #1" prio=5 tid=4 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x447c9b18 self=0x139258
  | sysTid=7790 nice=0 sched=0/0 cgrp=default handle=1271880
  | schedstat=( 12756347 35614013 13 )
  at dalvik.system.NativeStart.run(Native Method)

"Signal Catcher" daemon prio=5 tid=3 RUNNABLE
  | group="system" sCount=0 dsCount=0 s=N obj=0x447c81e8 self=0x136948
  | sysTid=7789 nice=0 sched=0/0 cgrp=default handle=1249544
  | schedstat=( 4150389 20233155 9 )
  at dalvik.system.NativeStart.run(Native Method)

"HeapWorker" daemon prio=5 tid=2 VMWAIT
  | group="system" sCount=1 dsCount=0 s=N obj=0x43a1c590 self=0x136708
  | sysTid=7788 nice=0 sched=0/0 cgrp=default handle=1248984
  | schedstat=( 247253419 294708251 77 )
  at dalvik.system.NativeStart.run(Native Method)
4

1 回答 1

2

ANR keyDispatchingTimedOut 表示您的活动被卡在做某事并且无法对下一个用户输入做出反应。

要读取堆栈跟踪,只需扫描它,直到您看到您的包名称,这是您想要专注的位。

我以前回答过这个问题: ANR keyDispatchingTimedOut 错误

ANR 错误

活动无响应。

您的活动花了很长时间才对 Android 操作系统说“嘿,我还活着”!(这就是 UI 线程所做的)。

http://developer.android.com/guide/practices/design/responsiveness.html

基本上,如果您让 UI 线程执行一些复杂的任务,那么您的任务就太忙了,无法告诉操作系统它仍然“活着”。

http://developer.android.com/resources/articles/painless-threading.html

您应该将您的数据库选择/更新/删除代码移动到另一个线程,然后使用回调告诉 UI 线程您已完成并对结果进行处理。

http://developer.android.com/resources/articles/timed-ui-updates.html

于 2011-06-23T15:56:48.143 回答