Home » Android » Android: What does this warning message refer to? – (WebCore)

Android: What does this warning message refer to? – (WebCore)

Posted by: admin May 14, 2020 Leave a comment


I have a Gallery which contains WebView’s as its children, when I scroll the Gallery I am getting the following warning,

'04-07 19:35:37.409: WARN/webcore(664): Can't get the viewWidth after the first layout
 04-07 19:35:37.470: WARN/webcore(664): skip viewSizeChanged as w is 0'

What does this warning refer to ? [I have not hardcoded any of the Layout params.]

Any light on why this warning occurs would be really helpful…

and these were printed too

04-15 11:10:13.202: DEBUG/webviewglue(617): nativeDestroy view: 0x257f40
04-15 11:10:13.243: DEBUG/webviewglue(617): nativeDestroy view: 0x25d680
04-15 11:10:13.292: DEBUG/webviewglue(617): nativeDestroy view: 0x240688
04-15 11:10:13.332: DEBUG/webviewglue(617): nativeDestroy view: 0x249918
04-15 11:10:13.373: DEBUG/webviewglue(617): nativeDestroy view: 0x226608
04-15 11:10:13.423: DEBUG/webviewglue(617): nativeDestroy view: 0x21e418
04-15 11:10:13.482: DEBUG/webviewglue(617): nativeDestroy view: 0x23a4e8
04-15 11:10:13.533: DEBUG/webviewglue(617): nativeDestroy view: 0x235c68
04-15 11:10:13.572: DEBUG/webviewglue(617): nativeDestroy view: 0x212a28

Thanks in advance.

How to&Answers:

I’ve had the same problem my normal webview wouldn’t work and gave me the same error as you have described.

skip viewSizeChanged as w is 0

As I understand it this has to do with Android zoom which newer devices allows in order to avoid applications (designed for phones) appear as small window applications on e.g. tablets.

My solution:

WebView mWebView = (WebView) findViewById(R.id.webview);

the last line setBuiltInZoomControls(true) made the issue disappear for me.
I hope this helps you!

[EDIT] This solution worked fine for me yesterday, however this morning I got the error again. This is probably not the solution. Sorry for misleading post.

[EDIT2] Now I have changed my code and I haven’t experienced the error again after that, I ran a test suite of 1000 iterations without fault. What solved my problem was that the url wasn’t passed correctly to the webview. It got an empty string, after making sure that a correct url the problem disappeared. Hopefully this will help someone.


Your viewSize has changed and is notifying of this, with the width value of 0 for some reason (zoom possibly). As seen here:

// notify webkit that our virtual view size changed size (after inv-zoom)
            private void viewSizeChanged(int w, int h, int textwrapWidth,
                    float scale, int anchorX, int anchorY, boolean ignoreHeight) {
                if (DebugFlags.WEB_VIEW_CORE) {
                    Log.v(LOGTAG, "viewSizeChanged w=" + w + "; h=" + h
                            + "; textwrapWidth=" + textwrapWidth + "; scale="
                            + scale);
                if (w == 0) {
                    Log.w(LOGTAG, "skip viewSizeChanged as w is 0");
                int width = w;
                if (mSettings.getUseWideViewPort()) {
                    if (mViewportWidth == -1) {
                        if (mSettings.getLayoutAlgorithm() == WebSettings.LayoutAlgorithm.NORMAL) {
                            width = WebView.DEFAULT_VIEWPORT_WIDTH;
                        } else {
                             * if a page's minimum preferred width is wider than the
                             * given "w", use it instead to get better layout result. If
                             * we start a page with MAX_ZOOM_WIDTH, "w" will be always
                             * wider. If we start a page with screen width, due to the
                             * delay between {@link #didFirstLayout} and
                             * {@link #viewSizeChanged},
                             * {@link #nativeGetContentMinPrefWidth} will return a more
                             * accurate value than initial 0 to result a better layout.
                             * In the worse case, the native width will be adjusted when
                             * next zoom or screen orientation change happens.
                            width = Math.min(WebView.sMaxViewportWidth, Math
                                    .max(w, Math.max(
                    } else if (mViewportWidth > 0) {
                        width = Math.max(w, mViewportWidth);
                    } else {
                        width = textwrapWidth;


The documentation I used for this reference is here for more information. Without seeing your code I’m not sure exactly why it’s happening though. Then it is obviously just skipping the adjustment of any views with these parameters and thus you have your logs.

[EDIT] Without being able to show code (understandable) the only thing I can really reference other than what I said before is a discussion I read a while ago here, that sheds light on the fact that different contexts contain different data. You might be able to use the Activity Context instead of the Engine, or Application Context.. Not much help, but might be a first golden brick. 😕 Good luck mate, hope you manage and I’ll keep my eyes out for any references to give you.