来自android.webkit.WebViewClassic.loadDataWithBaseURL中的Webview的Java nullpointer异常
作者:互联网
根据this question中提供的建议,我修改了我的AdMob代码以符合建议,这有效地减少了出现的异常数量.然而,一个新的例外正在上升.
代码如下:
@Override
protected void onDestroy() {
if ( adView != null ) {
adView.destroy();
adView = null;
Log.i(ApplicationData.APP_TAG, TAG + ": OnDestroy, destroying the Adview");
}
super.onDestroy();
}
随着LogCat消息的发布,方法adView.destroy()似乎运行良好.在此消息之后,我在WebView上收到以下异常:
java.lang.NullPointerException
at android.webkit.WebViewClassic.loadDataWithBaseURL(WebViewClassic.java:2741)
at android.webkit.WebView.loadDataWithBaseURL(WebView.java:919)
at com.google.android.gms.ads.internal.request.n.run(SourceFile:206)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5297)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
不幸的是,我无法找到重现问题的方法,但是经常在生产中发生.我一直没能找到任何问题,有人暗示我能做些什么吗?
解决方法:
谷歌移动广告SDK团队之一(3月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.
参见https://groups.google.com/forum/#!topic/google-admob-ads-sdk/oYpQI_L14Tg
标签:android,android-webview,adview 来源: https://codeday.me/bug/20190612/1223273.html