I tried for 3 days an Android application that uses webview
to download my website containing thousands of images. The application starts well, but after scrolling through a couple of hundred images the webview
freezes (doesnβt force-close) logcat (check it on pastebin) shows
E/Surface dequeueBuffer failed (Unknown error 2147483646)
What I tried:
- To limit the number of images for each action, when the user views 100 images, start another action.
- Clear web cache cache onCreation, onPause, onStop, etc.
clearCache(true);
- Set the web cache cache to false
setAppCacheEnabled(false);
- Kill activity A after opening operation B and vice versa
- Set
webView.setLayerType()
to NONE, SOFTWARE and HARDWARE - Declare
"android:largeHeap="true"
and android:hardwareAccelerated="true"
in the manifest. - Place the web view inside the placeholder, delete it before
finish();
webViewPlaceholder.removeView(myWebView); myWebView.removeAllViews(); myWebView.destroy();
It seems that android stores the webview
in memory, and clearing the cache has no effect.
When I close the application and open it again, an error appears immediately, so it seems that even closing the application does not free up the memory that it uses.
I honestly donβt see a way to fix this, I read a lot of answers on SO to web browsing problems, but I still could not fix this problem. I would appreciate the light here!
source share