Need help reading the stack traces

走远了吗. 提交于 2019-12-13 18:30:54

问题


I'm getting these stack traces when running my app which crash. I get that it has to do something with "ANR keyDispatchingTimedOut". I'm new in Android development and I need some helping reading the traces.

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:


ANR keyDispatchingTimedOut means your activity was stuck doing something and couldn't react to the next user input.

To read a stacktrace just scan it until you see your package name, that is the bit you want to concentrate on.

I've answered this once before: ANR keyDispatchingTimedOut error

ANR Error

Activity Not Responding.

Your activity took to long to say to the Android OS 'hey i'm still alive'! (This is what the UI thread does).

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

Basically if you make the UI thread do some complex task it's too busy doing your task to tell the OS that it is still 'alive'.

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

You should move your Database select/update/delete code to another thread, then use a callback to tell the UI thread you have finished and to do something with the result.

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



来源:https://stackoverflow.com/questions/6457023/need-help-reading-the-stack-traces

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!