您好,登錄后才能下訂單哦!
1:KeyDispatchTimeout(5 seconds) --主要類型
按鍵或觸摸事件在特定時(shí)間內(nèi)無(wú)響應(yīng)
2:BroadcastTimeout(10 seconds)
BroadcastReceiver在特定時(shí)間內(nèi)無(wú)法處理完成
3:ServiceTimeout(20 seconds) --小概率類型
Service在特定的時(shí)間內(nèi)無(wú)法處理完成
DALVIK THREADS: (mutexes: tll=0 tsl=0 tscl=0 ghl=0 hwl=0 hwll=0) "main" prio=5 tid=1 NATIVE | group="main" sCount=1 dsCount=0 obj=0x40025340 self=0xd180 | sysTid=1071 nice=0 sched=0/0 cgrp=default handle=-1344994080 | schedstat=( 2355584448 1199910712 3410 ) at java.net.InetAddress.getaddrinfo(Native Method) at java.net.InetAddress.lookupHostByName(InetAddress.java:540) at java.net.InetAddress.getAllByNameImpl(InetAddress.java:333) at java.net.InetAddress.getAllByName(InetAddress.java:295) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:100) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:79) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:353) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:120) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:316) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:298) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:236) at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:645) at com.rayray.cool.util.URLUtil.invokeURL(URLUtil.java:136) at com.rayray.cool.activity.WoDeJianYiActivity$1.onClick(WoDeJianYiActivity.java:173) at android.view.View.performClick(View.java:2535) at android.view.View$PerformClick.run(View.java:9129) at android.os.Handler.handleCallback(Handler.java:618) at android.os.Handler.dispatchMessage(Handler.java:123) at android.os.Looper.loop(SourceFile:351) at android.app.ActivityThread.main(ActivityThread.java:3821) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:538) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:969) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:727) at dalvik.system.NativeStart.main(Native Method)
出現(xiàn)ANR問(wèn)題的原因就是上面紅色代碼中
at com.rayray.cool.activity.WoDeJianYiActivity$1.onClick(WoDeJianYiActivity.java:173) 是Android中Activity
at com.rayray.cool.util.URLUtil.invokeURL(URLUtil.java:136) 是一次耗時(shí)的聯(lián)網(wǎng)請(qǐng)求
Activity中的按鍵事件在特定事件內(nèi)未響應(yīng)造成。
(1)耗時(shí)的操作放入單獨(dú)的線程中處理,如(聯(lián)網(wǎng)、數(shù)據(jù)庫(kù)、IO)
(2)盡量避免和UI線程的操作
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。