In my app, I need to use webview to load many html files. After several user operations, the app crashes. LogCat shows the following error: ReferenceTable overflow(max=512)
. I also found the reason behind the crash. It was a bug in webkit before os 4.1
I don't know how to avoid this bug. Any workaround is appreciated.
Edit: I just use mWebview to load local html file(contained in epub file). 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();
}
My error log as follows:
The same problem: Android Webview JNI ERROR with loadUrl