我有一个奇怪的bug,但没有找到任何可能的解决方案。在使用我的应用程序后,这个问题总是随机出现。这款应用程序在几乎所有设备上都能完美运行。然而,出现这个问题的设备之一是运行CM 7.1.0的设备,我知道很多CM7用户都在抱怨类似的问题。
不幸的是,我有一些用户也遇到了同样的问题,但我不知道他们是否在使用CM7。由于我无法在同一个ROM上的其他应用程序中重现此错误,因此它一定与其他什么相关。
正如我之前所说的,它看起来完全是随机的,所以复制源代码是没有意义的。这里是日志,希望有人已经有了同样的问题,可以帮助我。谢谢。
msm7k.gralloc(1306): alloc mmap(fd=150, size=614400, prot=3) failed (Try again)
msm7k.gralloc(1306): gralloc failed err=Try again
GraphicBufferAllocator(1306): alloc(320, 480, 1, 00000033, ...) failed -11 (Try again)
GraphicBufferAllocator(1306): Allocated buffers:
GraphicBufferAllocator(1306): 0x20a8d0: 300.00 KiB | 320 ( 320) x 480 | 4 | 0x00000133
GraphicBufferAllocator(1306): 0x20c110: 531.25 KiB | 320 ( 320) x 425 | 1 | 0x00000133
GraphicBufferAllocator(1306): 0x292db0: 31.25 KiB | 320 ( 320) x 25 | 1 | 0x00000133
GraphicBufferAllocator(1306): 0x299568: 300.00 KiB | 320 ( 320) x 480 | 4 | 0x00000133
GraphicBufferAllocator(1306): 0x4a2288: 331.25 KiB | 320 ( 320) x 265 | 1 | 0x00000133
GraphicBufferAllocator(1306): 0x4b2518: 31.25 KiB | 320 ( 320) x 25 | 1 | 0x00000133
GraphicBufferAllocator(1306): Total allocated: 1525.00 KB
SurfaceFlinger(1306): Layer::requestBuffer(this=0x3a7618), index=0, w=320, h=480 failed (Try again)
Surface(7024): Surface (identity=224) requestBuffer(0, 0, 0, 0, 00000033) returned a buffer with a null handle
Surface(7024): getBufferLocked(0, 0, 0, 0, 00000033) failed (Out of memory)
Surface(7024): dequeueBuffer failed (Out of memory)
ViewRoot(7024): OutOfResourcesException locking surface
ViewRoot(7024): android.view.Surface$OutOfResourcesException
ViewRoot(7024): at android.view.Surface.lockCanvasNative(Native Method)
ViewRoot(7024): at android.view.Surface.lockCanvas(Surface.java:314)
ViewRoot(7024): at android.view.ViewRoot.draw(ViewRoot.java:1461)
ViewRoot(7024): at android.view.ViewRoot.performTraversals(ViewRoot.java:1263)
ViewRoot(7024): at android.view.ViewRoot.handleMessage(ViewRoot.java:1865)
ViewRoot(7024): at android.os.Handler.dispatchMessage(Handler.java:99)
ViewRoot(7024): at android.os.Looper.loop(Looper.java:130)
ViewRoot(7024): at android.app.ActivityThread.main(ActivityThread.java:3835)
ViewRoot(7024): at java.lang.reflect.Method.invokeNative(Native Method)
ViewRoot(7024): at java.lang.reflect.Method.invoke(Method.java:507)
ViewRoot(7024): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
ViewRoot(7024): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
ViewRoot(7024): at dalvik.system.NativeStart.main(Native Method)发布于 2012-07-09 18:30:21
经过长时间的git提交,我终于找到了一个没有这个问题的。由于我正在开发的应用程序在屏幕上显示敏感数据,因此我尝试更改在“最近的应用程序”部分中显示为缩略图的图像。为了实现这一点,我给窗口设置了安全标志:
http://developer.android.com/reference/android/view/Window.html#setFlags(int http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SECURE
事实证明,这就是导致异常和显示黑屏的问题。在我移除它之后,一切都运行得很好。希望这篇技巧能帮助其他面临同样问题的开发者。
发布于 2012-07-06 18:36:19
如果您不再使用android.view.Surface,则需要调用release()。
http://developer.android.com/intl/es/reference/android/view/Surface.html#release()
发布于 2013-11-06 16:40:48
我也有类似的问题,但与HW表面有关。
我有ProgressDialog和SignIn组件。此组件之间的所有通信都通过Handler类完成。
在我的例子中,避免崩溃的唯一方法是关闭特定活动的硬件加速。
https://stackoverflow.com/questions/11360534
复制相似问题