关于 ThreadedRenderer.finalize() timed out after 10 s 报错的处理

2023-05-10 19:08:38 浏览数 (1)

全部报错日志 :

代码语言:javascript复制
E/AndroidRuntime: FATAL EXCEPTION: FinalizerWatchdogDaemon
                                                                            Process: com.cn.sixuekeji.xinyongfu, PID: 11054
                                                                            java.util.concurrent.TimeoutException: android.view.ThreadedRenderer.finalize() timed out after 10 seconds
                                                                                at android.view.ThreadedRenderer.nDeleteProxy(Native Method)
                                                                                at android.view.ThreadedRenderer.finalize(ThreadedRenderer.java:448)
                                                                                at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:206)
                                                                                at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:189)
                                                                                at java.lang.Thread.run(Thread.java:818)

自己找到的问题地址: http://stackoverflow.com/questions/27232275/java-util-concurrent-timeoutexception-android-view-threadedrenderer-finalize/

问题解决描述:

代码语言:javascript复制
Since KitKat, I have issues with WebViews (freeze, crash)

I have resolved these issues deactivating hardware acceleration for webViews. It could work for you.

if (Build.VERSION.SDK_INT >= 19) // KITKAT
{
    webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}

看描述,说是webveiw的硬件加速一直在启用,所以会造成此类错误. 我在所有用到webview的代码中,都添加了如下代码:

代码语言:javascript复制
if (Build.VERSION.SDK_INT >= 19) // KITKAT
{
    webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}

0 人点赞