如何修复位图大小超出 VM 预算的错误

发布于 2024-10-11 09:24:20 字数 2356 浏览 2 评论 0原文

我正在将一个应用程序图像上传到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烧了回忆取暖 2024-10-18 09:24:20

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

流星番茄 2024-10-18 09:24:20

你有内存泄漏。您需要进行调查才能找到它。这可能是未发布的位图或游标...

检查堆以查看你有什么样的物品。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文