gpt4 book ai didi

Android硬件加速webview崩溃

转载 作者:行者123 更新时间:2023-11-29 02:08:18 32 4
gpt4 key购买 nike

通过 android 市场,我的应用程序用户报告了大量 UnsupportedOperation 异常。堆栈跟踪指向从内部 webview 代码进行的 drawPicture() 调用。我确实在我的应用程序中使用了 WebView 。

我知道当 HWA 打开时不支持 drawPicture(),但在这种情况下,调用来自 webview 内部。我是否需要采取特殊步骤来确保 webview 不会使用此方法?

不幸的是我没能重现这个问题,但它肯定被用户看到了。

堆栈跟踪:

java.lang.UnsupportedOperationException
at android.view.GLES20Canvas.drawPicture(GLES20Canvas.java:753)
at android.webkit.WebView.drawCoreAndCursorRing(WebView.java:4128)
at android.webkit.WebView.drawContent(WebView.java:3797)
at android.webkit.WebView.onDraw(WebView.java:3862)
at android.view.View.draw(View.java:9286)
at android.view.View.getDisplayList(View.java:8749)
at android.view.ViewGroup.drawChild(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
at android.view.View.getDisplayList(View.java:8747)
at android.view.ViewGroup.drawChild(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
at android.view.View.draw(View.java:9289)
at android.view.View.getDisplayList(View.java:8749)
at android.view.ViewGroup.drawChild(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
at android.view.View.getDisplayList(View.java:8747)
at android.view.ViewGroup.drawChild(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
at android.view.View.getDisplayList(View.java:8747)
at android.view.ViewGroup.drawChild(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
at android.view.View.draw(View.java:9289)
at android.widget.FrameLayout.draw(FrameLayout.java:419)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1923)
at android.view.View.getDisplayList(View.java:8749)
at android.view.ViewGroup.drawChild(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
at android.view.View.getDisplayList(View.java:8747)
at android.view.ViewGroup.drawChild(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
at android.view.View.draw(View.java:9289)
at android.view.View.getDisplayList(View.java:8749)
at android.view.ViewGroup.drawChild(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
at android.view.View.getDisplayList(View.java:8747)
at android.view.ViewGroup.drawChild(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
at android.view.View.getDisplayList(View.java:8747)
at android.view.ViewGroup.drawChild(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2189)
at android.view.View.draw(View.java:9289)
at android.widget.FrameLayout.draw(FrameLayout.java:419)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1923)
at android.view.View.getDisplayList(View.java:8749)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:609)
at android.view.ViewRoot.draw(ViewRoot.java:1600)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1416)
at android.view.ViewRoot.handleMessage(ViewRoot.java:2046)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4123)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
at dalvik.system.NativeStart.main(Native Method)

最佳答案

你在使用 restorePicture 吗? ( http://developer.android.com/reference/android/webkit/WebView.html#restorePicture(android.os.Bundle , java.io.File) )

硬件加速不支持该方法(并且该方法已被弃用,因此无论如何您都应该放弃它)。作为解决方法,您可以将 webview 设置为软件层,直到您加载一些其他内容。

关于Android硬件加速webview崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8750990/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com