表面 - dequeueBuffer失败(未知错误2147483646) [英] Surface - dequeueBuffer failed (Unknown error 2147483646)
问题描述
我一直在挣扎了3天一个Android应用程序,使用一个的WebView
来加载自己的网站,其中包含数千张图片。
该应用程序开始很好,但滚动槽几百图像的WebView后
冻结(不强行关闭)的 logcat的(检查在引擎收录)节目
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:
- 在限制对每一项活动图像的数量,当用户观看100 图像,启动另一个活动。
- 清除web视图缓存onCreation,在onPause,的onStop等...
clearCache(真);
- 设置web视图缓存为false
setAppCacheEnabled(假);
- 杀死活性的开幕活动B和反之亦然 在
- 将
webView.setLayerType()
为NONE,软件和硬件 - 声明
机器人:largeHeap =真正的
和机器人:hardwareAccelerated =真正的
在清单 -
把web视图一个占位符内将其删除之前,
结束();
- 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();
webViewPlaceholder.removeView(myWebView);
myWebView.removeAllViews();
myWebView.destroy();
看来,Android的保持的WebView
在内存中清除缓存没有任何影响。
当我关闭应用程序并重新打开它立即出现错误,如此看来,即使不关闭应用程序释放其占用的内存。
老实说,我不明白的方式来解决这个问题,我读过的答案相当数量的在SO上的WebView问题,但我还是没能解决问题。
我想AP preciate一个光在这里!
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!
推荐答案
有关奇巧4.4.3或更高版本将硬件加速设置为false:
for KitKat 4.4.3 or later set the hardware acceleration to false:
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
这篇关于表面 - dequeueBuffer失败(未知错误2147483646)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!