I've been struggling for 3 days with an android app that uses a webview to load my website that contains thousands of images. The application start well but after scrolling trough a couple hundred images the webview freezes (it doesn't force-close) the logcat (check it on pastebin) shows
E/Surface dequeueBuffer failed (Unknown error 2147483646) What I've tried:
- Limit the number of images on every activity, when a user views 100 images, start another activity.
- Clear the webview cache onCreation, onPause, onStop, etc...
clearCache(true); - Set the webview cache to false
setAppCacheEnabled(false); - Kill activity A after opening activity B and vice versa
- Set the
webView.setLayerType()to NONE, SOFTWARE and HARDWARE - Declare
"android:largeHeap="true"andandroid:hardwareAccelerated="true"on the manifest. - Put the webview inside a placeholder a remove it before
finish();
webViewPlaceholder.removeView(myWebView); myWebView.removeAllViews(); myWebView.destroy(); It seems that android keeps the webview in memory and cleaning the cache doesn't have any effect.
When I close the app and reopen it the error appears immediately, so it seems that not even closing the app releases the memory it uses.
I honestly don't see a way to fix this, I've read a fair amount of answers at SO to problems on webview but I still couldn't fix the problem.
I would appreciate a light here!