WebView导致SQLiteDiskIOException [英] WebView causes SQLiteDiskIOException

查看:155
本文介绍了WebView导致SQLiteDiskIOException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经有一段时间得到SQLiteDiskIOExceptions的报告(通过Flurry / acra)。我无法在当地重现这个问题,但这是我最常见的崩溃事件,在糟糕的一天在五十个会议中发生了一次。他们似乎在Android 2.3.x下特别频繁。

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.

我在我自己的代码中绝对不使用SQL,但是我有不止一个WebView同时运行,加上一个广告SDK)。错误都是由WebView引起的,通过以下任一方法:

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

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

(还收到了几个关于android.database.sqlite.SQLiteDatabaseCorruptException的报告,但这些非常罕见)。我在我自己的代码中注释了与清除WebView缓存有关的任何内容,但这没有帮助。

(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.

完整的LogCat转储在这里

有谁知道任何方式我可以防止,抓住或更清楚地隔离原因这些例外?他们太频繁,只是由于SD记忆体不良造成的。

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.

谢谢!

编辑:请求的源代码:

  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>


推荐答案

我也很难找到这些的确切来源错误。我发现 Google Groups AdMob论坛上的主题表明它可能与AdMod SDK有关。对于我来说,在发布最新更新后,这些错误开始显示,其中包括将AdMob SDK从v4.1.1升级到v4.3.1。你在使用AdMob吗?

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?

似乎在某些情况下,AdMob SDK会将其WebView从UI线程中操作,我猜这可能会导致各种问题,甚至可能是在管理不同线程时并发SQLite访问缓存。可能与 Android中的SQLiteDiskIOException 相关。也许值得检查,你自己的代码不会从UI线程处理WebViews。

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.

这篇关于WebView导致SQLiteDiskIOException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆