WebView / webcore error after introducing AdMob

I just added an AdView from AdMob into one of my activities. After adding this view, the activity gets started with some noticable lag. In LogCat, I see the following exception. It doesn't cause the app to stop, but shown as a warning:

W/webcore(12969): java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
W/webcore(12969):   at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:2207)
W/webcore(12969):   at android.webkit.WebViewCore$EventHub.access$10000(WebViewCore.java:1167)
W/webcore(12969):   at android.webkit.WebViewCore.removeMessages(WebViewCore.java:2454)
W/webcore(12969):   at android.webkit.WebView.sendOurVisibleRect(WebView.java:3383)
W/webcore(12969):   at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:776)
W/webcore(12969):   at android.webkit.ZoomManager.access$1900(ZoomManager.java:60)
W/webcore(12969):   at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:1372)
W/webcore(12969):   at android.os.Handler.handleCallback(Handler.java:608)
W/webcore(12969):   at android.os.Handler.dispatchMessage(Handler.java:92)
W/webcore(12969):   at android.os.Looper.loop(Looper.java:156)
W/webcore(12969):   at android.app.ActivityThread.main(ActivityThread.java:5109)
W/webcore(12969):   at java.lang.reflect.Method.invokeNative(Native Method)
W/webcore(12969):   at java.lang.reflect.Method.invoke(Method.java:511)
W/webcore(12969):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:991)
W/webcore(12969):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)
W/webcore(12969):   at dalvik.system.NativeStart.main(Native Method)
W/webcore(12969): java.lang.Throwable: EventHub.removeMessages(int what = 105) is not supported before the WebViewCore is set up.
W/webcore(12969):   at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:2207)
W/webcore(12969):   at android.webkit.WebViewCore$EventHub.access$10000(WebViewCore.java:1167)
W/webcore(12969):   at android.webkit.WebViewCore.removeMessages(WebViewCore.java:2454)
W/webcore(12969):   at android.webkit.WebView.sendViewSizeZoom(WebView.java:3619)
W/webcore(12969):   at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:782)
W/webcore(12969):   at android.webkit.ZoomManager.access$1900(ZoomManager.java:60)
W/webcore(12969):   at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:1372)
W/webcore(12969):   at android.os.Handler.handleCallback(Handler.java:608)
W/webcore(12969):   at android.os.Handler.dispatchMessage(Handler.java:92)
W/webcore(12969):   at android.os.Looper.loop(Looper.java:156)
W/webcore(12969):   at android.app.ActivityThread.main(ActivityThread.java:5109)
W/webcore(12969):   at java.lang.reflect.Method.invokeNative(Native Method)
W/webcore(12969):   at java.lang.reflect.Method.invoke(Method.java:511)
W/webcore(12969):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:991)
W/webcore(12969):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)
W/webcore(12969):   at dalvik.system.NativeStart.main(Native Method)

I also noticed that this happens only at the first time the app runs. When I close the app and start again, it doesn't repeat. But the initial run is very important for the user experience so I think it's still an important issue. Any ideas?

Answers


It's almost certainly to do with WebView (used by AdView) creating it internal database, which it only does the first time a WebView is used in your app.

It used to be especially noticeable on Gingerbread (Android 2.3).

To mitigate I would programatically create a WebView when my app first started while showing a splash screen. Make sure you create it on the UI thread (use a handler etc).

Something like (in Activity#onCreate):

runOnUiThread(new Runnable() {
  void run() {
    new WebView(MyActivity.this);
  }
});

Need Your Help

How to capture emitted signal in same class in Qt creator

c++ qt

In my Qt creator application im emitting a signal by calling a member function,

Get locale in fragment

java android android-fragments android-intent locale

So what I did is that I created two buttons , and when one is pressed , an intent launches and the locale in the fragment changes. I did that through getting the locale value I desire , convert it ...