您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
1:KeyDispatchTimeout(5 seconds) --主要类型
按键或触摸事件在特定时间内无响应
2:BroadcastTimeout(10 seconds)
BroadcastReceiver在特定时间内无法处理完成
3:ServiceTimeout(20 seconds) --小概率类型
Service在特定的时间内无法处理完成
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)
出现ANR问题的原因就是上面红色代码中
at com.rayray.cool.activity.WoDeJianYiActivity$1.onClick(WoDeJianYiActivity.java:173) 是Android中Activity
at com.rayray.cool.util.URLUtil.invokeURL(URLUtil.java:136) 是一次耗时的联网请求
Activity中的按键事件在特定事件内未响应造成。
(1)耗时的操作放入单独的线程中处理,如(联网、数据库、IO)
(2)尽量避免和UI线程的操作
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。