android - ANR 和 Activity 报告停止,但不再停止
问题描述
我在某些设备和某些场合遇到了这个问题,我无法 100% 重现它。有时,当用户从我的活动中切换时,他们会收到此错误:Activity reported stop, but no longer stopping: ActivityRecord
通常它后面跟着一个 ANR,例如:
02-26 19:43:31.187 I/InputDispatcher( 1062): Application is not responding: Window{8f7e457 u0 gb.xxy.hr/gb.xxy.hr.player}. It has been 5000.8ms since event, 5000.6ms since wait started. Reason: 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: 14. Wait queue head age: 6964.8ms.
02-26 19:43:31.208 I/WindowManager( 1062): Input event dispatching timed out sending to gb.xxy.hr/gb.xxy.hr.player. Reason: 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: 14. Wait queue head age: 6964.8ms.
02-26 19:43:31.270 E/ActivityManager( 1062): ANR in gb.xxy.hr (gb.xxy.hr/.player)
02-26 19:43:31.270 E/ActivityManager( 1062): PID: 14732
02-26 19:43:31.270 E/ActivityManager( 1062): Reason: 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: 14. Wait queue head age: 6964.8ms.)
02-26 19:43:31.270 E/ActivityManager( 1062): Load: 0.0 / 0.0 / 0.0
02-26 19:43:31.270 E/ActivityManager( 1062): CPU usage from 179169ms to 0ms ago (2019-02-26 19:40:32.074 to 2019-02-26 19:43:31.243):
我的活动 onstop 没有代码,但我确实有一些代码可以释放表面:
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
myLog.d(TAG,"Surface Destroyed.");
try {
holder.removeCallback(this);
holder.getSurface().release();
}
catch (Exception e)
{
myLog.e(TAG,e.getMessage());
}
videoexecutor.shutdownNow();
visible=false;
m_codec.stop();
m_codec.release();
m_codec=null;
}
我确实看过一个类似的问题:Android onStop 超时,尽管没有做任何工作,我确实认为这在某种程度上是由表面引起的,但我无法弄清楚到底是什么原因造成的,为什么不在所有设备上而不是在所有设备上每时每刻....
有什么想法吗?
解决方案
推荐阅读
- ios - 在 SwiftUI 中手动设置明暗模式并节省用户选择
- javascript - 如何在高图表地图的选定区域上添加图标?
- java - 来自 org.springframework.data.mybatis.annotations.Version 的 @Version 在更新时不会增加 1,因为条件会破坏查询
- php - PHP:foreach 的奇怪行为
- angular - 无法使用 RxJS 6 递归查询和扩展运算符(Angular、Firebase 和 Observables)
- amazon-web-services - AWS SSM 按路径获取参数 操作 JSON
- docker - 如何在 CI 运行期间指定 katalon 帐户名称
- sql-server - 多连接查询超时问题
- elasticsearch - ElasticSearch:解释所有文档“_size”和“store.size_in_bytes”API 端点总和之间的差异?
- protractor - 使用量角器在网格中查找值