需要帮助阅读堆栈跟踪

时间:2011-06-23 15:54:37

标签: android stack-trace android-anr-dialog

我正在运行我的应用程序崩溃时获得这些堆栈跟踪。我知道它必须用“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)

1 个答案:

答案 0 :(得分:2)

ANR keyDispatchingTimedOut表示您的活动陷入困境,无法对下一个用户输入作出反应。

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

之前我曾回答过这个问题:ANR keyDispatchingTimedOut error

  

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