私のアプリでは、webview を使用して多くの html ファイルを読み込む必要があります。いくつかのユーザー操作の後、アプリがクラッシュします。LogCat に次のエラーが表示されます: ReferenceTable overflow(max=512)
。クラッシュの背後にある理由もわかりました。OS 4.1より前のWebkitのバグでした
このバグを回避する方法がわかりません。任意の回避策をいただければ幸いです。
編集: mWebview を使用して、ローカルの html ファイル (epub ファイルに含まれる) をロードするだけです。mWebView.loadChapter(mSpine.get(mIndex).getHref());
public void loadChapter(String path){
//loadUrl(resourceUri.toString());
Object localObject = "";
try{
InputStream is = this.getmBook().fetchFromZip(path);
localObject = fromStream(is);
is.close();
}catch(Exception e){
e.printStackTrace();
}
String str1 = "file:///" + path;
this.clearCache(true);
loadDataWithBaseURL(str1, (String)localObject, "text/html", "utf-8", null);
}
public String fromStream(InputStream in) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuilder out = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
out.append(line);
}
return out.toString();
}
私のエラーログは次のとおりです。