【问题标题】:Android WebView randomly not responding to touch eventsAndroid WebView 随机不响应触摸事件
【发布时间】:2015-11-30 14:14:32
【问题描述】:

我的 Android Web 应用程序有问题。

该应用程序安装在平板电脑 (LGV700 - 4.4.2) 上,仅为此目的运行(24/7 供电)。

该应用程序是 Web 应用程序的包装器,具有一些额外的功能,从远程 url 加载(webview 是在代码中动态创建的)。

问题是应用程序随机冻结/停止对大多数触摸事件做出反应(通常在长时间正常运行后),并且一直持续到应用程序重新启动。

使用分析器检查应用程序显示内存使用率很高,但 GC 似乎工作正常,在即将达到内存限制时清除所有未使用的内存。

我尝试将 largeHeap 和 hardwareAccelerated 属性添加到清单中,但似乎没有帮助。

我不确定这是唯一的问题,但有时应用程序会被强制关闭,并且会向 logcat 抛出以下错误:

11-30 13:01:54.477  28591-28652/********* W/Adreno-EGLSUB﹕ <DequeueBuffer:736>: dequeue native buffer fail: Unknown error 2147483646, buffer=0x0, handle=0x0
11-30 13:01:54.487  28591-28652/********* W/Adreno-ES20﹕ <core_glFlush:52>: GL_OUT_OF_MEMORY
11-30 13:01:54.487  28591-28652/********* W/Adreno-EGLSUB﹕ <DequeueBuffer:736>: dequeue native buffer fail: Function not implemented, buffer=0x0, handle=0x0
11-30 13:01:54.487  28591-28652/********* E/chromium﹕ [ERROR:gles2_cmd_decoder.cc(2123)] [GroupMarkerNotSet(crbug.com/242999)!:549845A5]GL ERROR :GL_OUT_OF_MEMORY : GLES2DecoderImpl::PrepareTexturesForRender: <- error from previous GL command
11-30 13:01:54.487  28591-28652/********* E/chromium﹕ [ERROR:gles2_cmd_decoder.cc(4422)] Error: 5 for Command kDrawElements
11-30 13:01:54.487  28591-28652/********* W/Adreno-EGLSUB﹕ <DequeueBuffer:736>: dequeue native buffer fail: Function not implemented, buffer=0x0, handle=0x0
11-30 13:01:54.487  28591-28652/********* W/Adreno-EGL﹕ <qeglDrvAPI_eglSwapBuffers:3702>: EGL_BAD_SURFACE
11-30 13:01:54.487  28591-28652/********* W/OpenGLRenderer﹕ swapBuffers encountered EGL_BAD_SURFACE on 0xa542ff80, halting rendering...
11-30 13:01:54.777  28591-28652/********* W/google-breakpad﹕ ### ### ### ### ### ### ### ### ### ### ### ### ###
11-30 13:01:54.777  28591-28652/********* W/google-breakpad﹕ Chrome build fingerprint:
11-30 13:01:54.777  28591-28652/********* W/google-breakpad﹕ 1.0
11-30 13:01:54.777  28591-28652/********* W/google-breakpad﹕ 1
11-30 13:01:54.777  28591-28652/********* W/google-breakpad﹕ 45012863-7d3b-4c30-8ccf-e65394c57d85
11-30 13:01:54.777  28591-28652/********* W/google-breakpad﹕ ### ### ### ### ### ### ### ### ### ### ### ### ###
11-30 13:01:54.777  28591-28652/********* A/libc﹕ Fatal signal 11 (SIGSEGV), code 1, fault addr 0x54 in tid 28652 (RenderThread)

看起来像这个问题:https://code.google.com/p/chromium/issues/detail?id=437017, 但它似乎已修复。

当应用程序检测到 Internet 连接丢失时,它会使用带有原始 url 的 loadUrl 函数重新加载 webview。

另外值得一提的是,我使用“ANR-WatchDog”库来检测 Application Not Responding 错误(检查主线程是否超过 5 秒没有响应),但是当问题发生时它是静默的。

有什么想法吗?

【问题讨论】:

    标签: android angularjs webview android-anr-dialog


    【解决方案1】:

    在你的 java 代码中试试这个:

    webview.getSettings().setRenderPriority(RenderPriority.HIGH);
    webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    

    并将其添加到您的 manifest.xml:

    android:hardwareAccelerated="true"
    

    【讨论】:

    • 感谢您的快速回答。我已经使用了上面的命令。
    • bro setRenderPriority() 已弃用。请看一下。
    猜你喜欢
    • 2011-01-23
    • 1970-01-01
    • 1970-01-01
    • 2010-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多