4

Am having a weird issue working with chromium webview on Android Kitkat [Chromium 30].

Sometimes the web content fails to load with this printed in the logs:

nativeondraw failed clearing to background color

Just a blank screen is with zeta theme color as background is shown. This issue randomly occurs a few times, while using the app.

I checked out several resources and most of them suggest turning off hardware acceleration for the webview because it seems to be because hardware accelerated canvas rendering is not supported in Chromium WebView.

References:

Theres definitely a bad impact of turning off hardware acceleration for the webview.

  • The rendering before disabling hardware acceleration is below 16ms for most of the times.
  • After disabling, its consistently above 16ms.

Moreover, "Could not lock surface" seems to be a related issue. Searching for solutions, points at the same solution.

Could not lock surface
 E  java.lang.IllegalArgumentException
 E      at android.view.Surface.nativeLockCanvas(Native Method)
 E      at android.view.Surface.lockCanvas(Surface.java:246)
 E      at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2435)
 E      at android.view.ViewRootImpl.draw(ViewRootImpl.java:2409)
 E      at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2253)
 E      at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1883)
 E      at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
 E      at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
 E      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
 E      at android.view.Choreographer.doCallbacks(Choreographer.java:574)
 E      at android.view.Choreographer.doFrame(Choreographer.java:544)
 E      at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
 E      at android.os.Handler.handleCallback(Handler.java:733)
 E      at android.os.Handler.dispatchMessage(Handler.java:95)
 E      at android.os.Looper.loop(Looper.java:137)
 E      at android.app.ActivityThread.main(ActivityThread.java:4998)
 E      at java.lang.reflect.Method.invokeNative(Native Method)
 E      at java.lang.reflect.Method.invoke(Method.java:515)
 E      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:811)
 E      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:627)
 E      at dalvik.system.NativeStart.main(Native Method)
Vivek Maskara
  • 1,073
  • 11
  • 29
  • which link you are opening in webview? – Rahul Khurana Feb 09 '18 at 10:53
  • The WebView in API 19 is known to be finicky about its own memory management. Is your app using multiple WebViews? Do you create/recreate WebViews within the same Activity? Do you make sure to uninitialize your WebViews correctly? These can all be contributing factors. – Dmitry Brant Feb 14 '18 at 00:17
  • - Yes, I have multiple WebViews in the same activity ie. my view pager has 5 tabs, 3 of which are WebViews. - I am just caching the immediate neighbour fragments, so yes my WebViews would be recreated while switching tabs - As of now i am not uninitialising the WebViews explicitly. What would be the best way to uninitialize the WebViews. – Vivek Maskara Feb 14 '18 at 09:06
  • Did you try adding crosswalk plugin? – Nikolay Shindarov Sep 26 '18 at 20:57

0 Answers0