Java nullpointer exception from Webview in android.webkit.WebViewClassic.loadDataWithBaseURL

断了今生、忘了曾经 提交于 2019-12-05 15:19:12

One of Google Mobile Ads SDK Team said (March 14),

We looked into this issue when it was first reported, and a fix has been released within Google Play services. You should see fewer and fewer instances as your users' devices update to the new version.

Refer to https://groups.google.com/forum/#!topic/google-admob-ads-sdk/oYpQI_L14Tg

This occurs when the WebView is destroyed before loadDataWithBaseUrl is called( probably by other thread). In AdMob code, i saw that they handle this now as follows

public void loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String historyUrl) {
        synchronized(this) {
            if(!this.isDestroyed()) {
                super.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);
            } else {
                Log.d("The webview is destroyed. Ignoring action.");
            }

        }
    }

So it should not occur now.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!