Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
214 views
in Technique[技术] by (71.8m points)

android - ANR keyDispatchingTimedOut error

i m getting this force down error in my app,when i m trying to parse RSS with DOM.it's not always the force down problem however...this is the logcat:

**ANR keyDispatchingTimedOut**

DALVIK THREADS:
"main" prio=5 tid=1 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x40025b50 self=0xcdb8
  | sysTid=2504 nice=0 sched=0/0 cgrp=bg_non_interactive handle=-1345017804
  | schedstat=( 573577878 521301271 1476 )
  at org.apache.harmony.luni.platform.OSNetworkSystem.readSocketImpl(Native Method)
  at org.apache.harmony.luni.platform.OSNetworkSystem.read(OSNetworkSystem.java:358)
  at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:561)
  at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:88)
  at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl$ChunkedInputStream.read(HttpURLConnectionImpl.java:458)
  at java.io.InputStreamReader.read(InputStreamReader.java:275)
  at org.kxml2.io.KXmlParser.peek(KXmlParser.java:931)
  at org.kxml2.io.KXmlParser.pushText(KXmlParser.java:881)
  at org.kxml2.io.KXmlParser.nextImpl(KXmlParser.java:354)
  at org.kxml2.io.KXmlParser.nextToken(KXmlParser.java:1406)
  at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:369)
  at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:362)
  at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:362)
  at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:362)
  at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:362)
  at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:135)
  at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:110)
  at kostas.menu.olympiakos.DomFeedParser.parse(DomFeedParser.java:26)
  at kostas.menu.olympiakos.nea.loadFeed(nea.java:51)
  at kostas.menu.olympiakos.nea.onCreate(nea.java:38)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1066)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2799)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2866)
  at android.app.ActivityThread.access$2300(ActivityThread.java:140)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2181)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:143)
  at android.app.ActivityThread.main(ActivityThread.java:5097)
  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:868)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  at dalvik.system.NativeStart.main(Native Method)

"Binder Thread #2" prio=5 tid=6 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x46eea810 self=0x135a00
  | sysTid=2509 nice=0 sched=0/0 cgrp=bg_non_interactive handle=1213600
  | schedstat=( 10253904 21514895 127 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #1" prio=5 tid=5 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x46eea748 self=0x12cab0
  | sysTid=2508 nice=0 sched=0/0 cgrp=bg_non_interactive handle=1301736
  | schedstat=( 12603756 119659428 129 )
  at dalvik.system.NativeStart.run(Native Method)

"Compiler" daemon prio=5 tid=4 VMWAIT
  | group="system" sCount=1 dsCount=0 s=N obj=0x46ee32a8 self=0x127bc8
  | sysTid=2507 nice=0 sched=0/0 cgrp=bg_non_interactive handle=1300256
  | schedstat=( 197021496 268585180 1155 )
  at dalvik.system.NativeStart.run(Native Method)

"Signal Catcher" daemon prio=5 tid=3 RUNNABLE
  | group="system" sCount=0 dsCount=0 s=N obj=0x46ee31e8 self=0xa8140
  | sysTid=2506 nice=0 sched=0/0 cgrp=bg_non_interactive handle=1299816
  | schedstat=( 915528 5706786 7 )
  at dalvik.system.NativeStart.run(Native Method)

"HeapWorker" daemon prio=5 tid=2 VMWAIT
  | group="system" sCount=1 dsCount=0 s=N obj=0x45947800 self=0x1224b8
  | sysTid=2505 nice=0 sched=0/0 cgrp=bg_non_interactive handle=1212984
  | schedstat=( 27404784 3082276 24 )
  at dalvik.system.NativeStart.run(Native Method)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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://android-developers.blogspot.co.uk/2009/05/painless-threading.html

You should move your XML Parsing 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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...