通过Android市场,我的应用程序用户报告了大量的UnsupportedOperation Exceptions。堆栈跟踪指向从webview代码内部进行的drawPicture()调用。我确实在我的应用中使用了网页浏览。
我知道打开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)
答案 0 :(得分:1)
您使用的是restorePicture吗? (http://developer.android.com/reference/android/webkit/WebView.html#restorePicture(android.os.Bundle,java.io.File))
硬件加速不支持该方法(并且该方法已被弃用,因此您无论如何都应该离开它)。作为一种解决方法,您可以将webview设置为软件层,直到您加载其他内容为止。