的WebView导致SQLiteDiskIOExceptionWebView、SQLiteDiskIOException

2023-09-04 13:15:31 作者:久入我梦 ι

我已经得到SQLiteDiskIOExceptions一段时间的报道,现在(通过乱舞/ ACRA)。我一直无法在本地重现该问题,但它是我最频繁的崩溃,在一个糟糕的一天发生了一次五十会议。他们似乎是在Android的2.3.x特别频繁。

我要在我自己的code绝对没有使用SQL,但我有一个以上的WebView同时运行(两,加一个广告SDK)。误差似乎都可以由web视图经由以下任一方法之一引起的,

android.webkit.WebViewDatabase.clearCache android.webkit.WebViewDatabase.flushCacheStat android.webkit.WebViewDatabase.deleteCookies android.webkit.WebViewDatabase.removeCache

(也收到了几个的android.database.sqlite.SQLiteDatabaseCorruptException的报道,但这些都是极其罕见)。我评论了关于清理在我自己的code中的web视图缓存任何东西,但没有帮助。

全部LogCat中倾倒在这里。

有谁知道什么办法可以prevent,渔获物,或更清楚地隔离这些异常的原因是什么?他们太频繁,只是被糟糕的SD存储引起的。

谢谢!

编辑:来源$ C ​​$ c。通过要求:

 浏览器=(web视图)findViewById(R.id.webkit);
  browser.setWebViewClient(新CustomWebViewClient(本,浏览器));
  WebSettings webSettings = browser.getSettings();
  webSettings.setJavaScriptEnabled(真正的);
  webSettings.setPluginsEnabled(真正的);
  browser.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY);
  webSettings.setBuiltInZoomControls(真正的);

  browser.setWebChromeClient(新WebChromeClient(){
    公共无效onProgressChanged(web视图来看,INT进度){
      progressbarhorizo​​ntal.setProgress(进度);
    }
  });
 

XML:

 <的WebView机器人:ID =@ + ID / WebKit的机器人:layout_width =FILL_PARENT机器人:layout_height =FILL_PARENT机器人:可聚焦=真正的机器人:nextFocusDown =@ + ID / bottomview>< /的WebView>
 
UIWebView导致ipa上传失败

解决方案

我也很努力找到这些错误的确切来源。我发现在谷歌论坛AdMob的论坛线程这表明它可能会涉及到AdMod SDK。对我来说,这些错误开始出现后,我发表了我的最新的更新,其中除其他的变化包括从V4.1.1升级AdMob的SDK来v4.3.1。您是否在使用AdMob的?

看来,AdMob的SDK在某些情况下,操纵其WebViews关闭UI线程的,我想可能会导致各种问题,从不同的线程可能即并发访问的SQLite管理高速缓存的时候。可能与SQLiteDiskIOException在Android的。也可能是值得的检查自己的code不操作WebViews关闭UI线程的。

I've been getting reports of SQLiteDiskIOExceptions for some time now (via Flurry/acra). I haven't been able to reproduce the issue locally, but it's my most frequent crash, occurring up to once in fifty sessions on a bad day. They seem to be particularly frequent under Android 2.3.x.

I make absolutely no use of SQL in my own code, but I have more than one WebView running simultaneously (two, plus an ads SDK). The errors all appear to be caused by a WebView, via one of any of the following methods:

android.webkit.WebViewDatabase.clearCache android.webkit.WebViewDatabase.flushCacheStat android.webkit.WebViewDatabase.deleteCookies android.webkit.WebViewDatabase.removeCache

(Also received a couple of reports of an android.database.sqlite.SQLiteDatabaseCorruptException , but these are extremely rare). I commented out anything relating to clearing the WebView cache in my own code, but that didn't help.

Full LogCat dumps here.

Does anyone know of any way I could prevent, catch, or more clearly isolate the cause of these exceptions? They're too frequent to just be caused by bad SD memory.

Thanks!

Edit: Source code by request:

  browser=(WebView)findViewById(R.id.webkit);
  browser.setWebViewClient( new CustomWebViewClient(this,browser) );
  WebSettings webSettings = browser.getSettings();
  webSettings.setJavaScriptEnabled(true);
  webSettings.setPluginsEnabled(true);
  browser.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY);
  webSettings.setBuiltInZoomControls(true);

  browser.setWebChromeClient(new WebChromeClient() {
    public void onProgressChanged(WebView view, int progress) {
      progressbarhorizontal.setProgress(progress);
    }
  });

XML:

        <WebView android:id="@+id/webkit" android:layout_width="fill_parent" android:layout_height="fill_parent" android:focusable="true" android:nextFocusDown="@+id/bottomview"></WebView>

解决方案

I too am struggling to find the exact source of these errors. I have found a thread on the Google Groups AdMob forum that suggests it might be related to the AdMod SDK. For me, these errors started showing up after I published my latest update, which among other changes included upgrading the AdMob SDK from v4.1.1 to v4.3.1. Are you using AdMob?

Seems that the AdMob SDK in some circumstances manipulates its WebViews off of the UI thread, which I guess could cause various problems, possibly i.e. concurrent SQLite access from different threads when managing the cache. Possibly related to SQLiteDiskIOException in Android. Might also be worthwhile checking that your own code does not manipulate WebViews off of the UI thread.