首页 > 解决方案 > 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 超时,尽管没有做任何工作,我确实认为这在某种程度上是由表面引起的,但我无法弄清楚到底是什么原因造成的,为什么不在所有设备上而不是在所有设备上每时每刻....

有什么想法吗?

标签: android

解决方案


推荐阅读