如何修复位图大小超出 VM 预算的错误
我正在将一个应用程序图像上传到 SD卡 我正在缩放保存到数据库中的 SD卡 有时会发生一个错误 位图大小超出虚拟机预算
ouput :
01-11 15:39:51.809: ERROR/AndroidRuntime(6214): Uncaught handler: thread main exiting due to uncaught exception
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:384)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:397)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at com.fitzgeraldsoftware.shout.presentationLayer.Shout.onActivityResult(Shout.java:1653)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.app.Activity.dispatchActivityResult(Activity.java:3624)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.app.ActivityThread.deliverResults(ActivityThread.java:3220)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3266)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.app.ActivityThread.access$2600(ActivityThread.java:116)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.os.Handler.dispatchMessage(Handler.java:99)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.os.Looper.loop(Looper.java:123)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.app.ActivityThread.main(ActivityThread.java:4203)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at java.lang.reflect.Method.invokeNative(Native Method)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at java.lang.reflect.Method.invoke(Method.java:521)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at dalvik.system.NativeStart.main(Native Method)
如何修复该错误 请转发一些解决方案 提前致谢
i am working one application image uploading to sdcard i am scaling that sdcard saved into database some times one error is occurs bitmap size exceeds vm budget
ouput :
01-11 15:39:51.809: ERROR/AndroidRuntime(6214): Uncaught handler: thread main exiting due to uncaught exception
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:384)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:397)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at com.fitzgeraldsoftware.shout.presentationLayer.Shout.onActivityResult(Shout.java:1653)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.app.Activity.dispatchActivityResult(Activity.java:3624)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.app.ActivityThread.deliverResults(ActivityThread.java:3220)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3266)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.app.ActivityThread.access$2600(ActivityThread.java:116)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.os.Handler.dispatchMessage(Handler.java:99)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.os.Looper.loop(Looper.java:123)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at android.app.ActivityThread.main(ActivityThread.java:4203)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at java.lang.reflect.Method.invokeNative(Native Method)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at java.lang.reflect.Method.invoke(Method.java:521)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
01-11 15:39:51.979: ERROR/AndroidRuntime(6214): at dalvik.system.NativeStart.main(Native Method)
how can fix the error please forward some solution thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
narasimha,我想这篇文章可能会帮助你
android-strange-out-of-memory -问题
或这个
java-lang-outofmemoryerror-bitmap-size-exceeds-vm- Budget-android
或者可能是这个
android-java-lang-outofmemoryerror
&还有更多问题
narasimha , I suppose may be this post will help you
android-strange-out-of-memory-issue
or this
java-lang-outofmemoryerror-bitmap-size-exceeds-vm-budget-android
or may be this
android-java-lang-outofmemoryerror
& there are more questions already there
你有内存泄漏。您需要进行调查才能找到它。这可能是未发布的位图或游标...
检查堆以查看你有什么样的物品。
You have a memory leak. You need to investigate to find it. This could be unreleased Bitmap or Cursor ...
Inspect the heap to see what kind of objects you have.