asp access网站开发实例精讲,旅游网站策划书模板,wordpress滑块轮播,做网站推广的前期条件前言
一个引发讨论的楔子#xff0c;以下三种现象有什么区别#xff1a;
App停止运行App暂无响应App闪退 答案#xff1a; 产生原因不同#xff1a;停止运行是UNCheckExceptionError暂无响应是ANRDialog闪退是CheckExceptionError 本文讨论的主题是ANR的定义、分类、复现…前言
一个引发讨论的楔子以下三种现象有什么区别
App停止运行App暂无响应App闪退 答案 产生原因不同停止运行是UNCheckExceptionError暂无响应是ANRDialog闪退是CheckExceptionError 本文讨论的主题是ANR的定义、分类、复现、分析、优化。
ANR定义
Application Not Responding
ANR类型
Input dispatching timed out
按键或触摸事件在特定时间内无响应origin:5s KEY_DISPATCHING_TIMEOUT 8*1000
12-08 10:51:08.136 763-787/system_process E/ANRManager: ANR in com.xx(com.xx/com.xxactivity.ScreenSaverPicSelectActivity), time26867631Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 36. Wait queue head age: 8510.1ms.)Broadcast Timeout
BroadcastReceiver在特定时间内无法处理完成 BROADCAST_FG_TIMEOUT: 10s BROADCAST_BG_TIMEOUT: 60s 按键和广播事件时间内未响应时间限定定义在ActivityManagerService.java类中
Service Timeout
Service在特定的时间内无法处理完成,属于小概率类型 service时间内未响应时间限定在ActiveServices.java类中 SERVICE_TIMEOUT 20*1000;
Activity Timeout
名称 时间 Activity#onPause 500ms Activity#onStop 10s
Activity#onDestory 10s12-08 17:22:11.296 719-743/system_process W/ActivityManager:
Activity stop timeout for ActivityRecord{2fd135ba u0 com.xx./com.unilife.fridge.home.banner.OpenFullScreenActivity t206}ANR原因
应用进程有一个主线程main thread和一个信息队列(main message queue) main thead activity thread主线程负责处理像Draw、Listen、receive等UI事件主线程负责从消息队列中取出信息并分发它主线程在完成当前信息处理之前不会再取信息队列中的信息如果主线程在处理当前信息时卡住没有及时分发ANR就会出现
ANR检测
ANR检测工具