应用程序崩溃相机 [英] App camera crash

查看:151
本文介绍了应用程序崩溃相机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用的是一个教程,在developer.android.com:
http://developer.android.com/training/camera/photobasics.html
与API 2.1

I use the next tutorial, in developer.android.com : http://developer.android.com/training/camera/photobasics.html with API 2.1


  • 当我点击在拿小图片,没有问题

  • 当我点击拍摄小图片后,我点击拍摄大画面,没问题

  • 但是,当我在大画面直接点击,我拍照,我的应用程序崩溃...

在LogCat中:

05-10 09:26:30.773: D/CameraSample(3407): failed to create directory
05-10 09:26:33.713: W/IInputConnectionWrapper(3407): showStatusIcon on inactive InputConnection
05-10 09:26:45.883: I/Parcours(3407): handleBigCameraPhoto
05-10 09:26:46.133: D/dalvikvm(3407): GC_EXTERNAL_ALLOC freed 124K, 52% free 2628K/5379K, external 1685K/2133K, paused 207ms
05-10 09:26:46.143: E/dalvikvm-heap(3407): 31961088-byte external allocation too large for this process.
05-10 09:26:46.163: E/GraphicsJNI(3407): VM won't let us allocate 31961088 bytes
05-10 09:26:46.213: D/dalvikvm(3407): GC_FOR_MALLOC freed 2K, 52% free 2625K/5379K, external 1685K/2133K, paused 55ms
05-10 09:26:46.213: D/skia(3407): --- decoder->decode returned false
05-10 09:26:46.213: D/AndroidRuntime(3407): Shutting down VM
05-10 09:26:46.223: W/dalvikvm(3407): threadid=1: thread exiting with uncaught exception (group=0x4001d560)
05-10 09:26:46.223: E/AndroidRuntime(3407): FATAL EXCEPTION: main
05-10 09:26:46.223: E/AndroidRuntime(3407): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
05-10 09:26:46.223: E/AndroidRuntime(3407):     at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:470)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:284)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at rdaquin.apps.takephoto.TakePhotoActivity.setPic(TakePhotoActivity.java:124)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at rdaquin.apps.takephoto.TakePhotoActivity.handleBigCameraPhoto(TakePhotoActivity.java:195)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at rdaquin.apps.takephoto.TakePhotoActivity.onActivityResult(TakePhotoActivity.java:281)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at android.app.Activity.dispatchActivityResult(Activity.java:3908)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at android.app.ActivityThread.deliverResults(ActivityThread.java:2549)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:2595)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at android.app.ActivityThread.access$2000(ActivityThread.java:121)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:973)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at android.os.Looper.loop(Looper.java:123)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at android.app.ActivityThread.main(ActivityThread.java:3701)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at java.lang.reflect.Method.invokeNative(Native Method)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at java.lang.reflect.Method.invoke(Method.java:507)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
05-10 09:26:46.223: E/AndroidRuntime(3407):     at dalvik.system.NativeStart.main(Native Method)

如果你需要一个code,问我。

If have you need a code, ask me.

我不明白为什么我的应用程序崩溃,我觉得这是一个记忆的问题,但我不知道该怎么办。
所以,当我愿意拿小图像和采取一个大图片它的工作原理。但是,如果我重新加载应用程序,并说我拿一个大图片不能正常工作

I do not understand why my application crashes, I feel that this is a memory problem but I do not know what to do. So that when I do "take a small image" and "take a big picture" it works. But if I reload the application and that I "take a big picture" does not work

推荐答案

我认为这是pretty从堆栈跟踪,它说你跑出来的内存,因为你想在堆上分配32MB明显。你不能做到这一点。并不奇怪,因为当你把一个大的图片出现这种情况。你不能把它在内存中。其写入存储设备。

I think it's pretty obvious from the stack trace, which says you ran out of memory because you tried to allocate 32MB on the heap. You can't do that. Not surprising since this happens when you take a big picture. You can't put it in memory. Write it to storage.

这篇关于应用程序崩溃相机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆