jaydeepw / poly-picker

Android library project for providing multiple image selection from the device.
406 stars 114 forks source link

OutOfMemory error when taking a photo on Samsung Galaxy S4 #34

Closed sogwiz closed 9 years ago

sogwiz commented 9 years ago

When I use this library, I am getting a force close everytime I attempt to take a camera photo using the S4. It is not occurring when I use an LG G2.

Scenario:

  1. Invoke the ImagePicker
  2. Take a picture ERROR: after taking the photo, a force close occurs.

03-17 15:41:48.843 6484-6484/com.b2.assyrian.activity D/Dialog﹕ checkMirrorLinkEnabled returns : false 03-17 15:41:48.843 6484-6484/com.b2.assyrian.activity D/Dialog﹕ showing allowed 03-17 15:41:48.963 6484-6484/com.b2.assyrian.activity D/ProgressBar﹕ updateDrawableBounds: left = 0 03-17 15:41:48.963 6484-6484/com.b2.assyrian.activity D/ProgressBar﹕ updateDrawableBounds: top = 0 03-17 15:41:48.963 6484-6484/com.b2.assyrian.activity D/ProgressBar﹕ updateDrawableBounds: right = 102 03-17 15:41:48.963 6484-6484/com.b2.assyrian.activity D/ProgressBar﹕ updateDrawableBounds: bottom = 102 03-17 15:41:50.054 6484-7118/com.b2.assyrian.activity D/dalvikvm﹕ GC_FOR_ALLOC freed 719K, 48% free 36322K/68756K, paused 62ms, total 63ms 03-17 15:41:50.164 6484-7118/com.b2.assyrian.activity I/dalvikvm-heap﹕ Grow heap (frag case) to 75.326MB for 38340880-byte allocation 03-17 15:41:50.404 6484-7118/com.b2.assyrian.activity D/dalvikvm﹕ GC_FOR_ALLOC freed 30K, 31% free 73734K/106200K, paused 31ms, total 31ms 03-17 15:41:50.404 6484-7118/com.b2.assyrian.activity I/dalvikvm-heap﹕ Forcing collection of SoftReferences for 38340880-byte allocation 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity D/dalvikvm﹕ GC_BEFORE_OOM freed 78K, 31% free 73655K/106200K, paused 42ms, total 42ms 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity E/dalvikvm-heap﹕ Out of memory on a 38340880-byte allocation. 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity I/dalvikvm﹕ "Thread-661" prio=5 tid=27 RUNNABLE 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity I/dalvikvm﹕ | group="main" sCount=0 dsCount=0 obj=0x42d251e0 self=0x73ac8fd8 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity I/dalvikvm﹕ | sysTid=7118 nice=0 sched=0/0 cgrp=apps handle=2106290368 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity I/dalvikvm﹕ | state=R schedstat=( 0 0 0 ) utm=31 stm=12 core=2 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity I/dalvikvm﹕ at android.graphics.Bitmap.nativeCreate(Native Method) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity I/dalvikvm﹕ at android.graphics.Bitmap.createBitmap(Bitmap.java:929) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity I/dalvikvm﹕ at android.graphics.Bitmap.createBitmap(Bitmap.java:902) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity I/dalvikvm﹕ at android.graphics.Bitmap.createBitmap(Bitmap.java:834) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity I/dalvikvm﹕ at com.commonsware.cwac.camera.ImageCleanupTask.run(ImageCleanupTask.java:121) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity I/dalvikvm﹕ [ 03-17 15:41:50.444 6484: 7118 W/dalvikvm ] threadid=27: thread exiting with uncaught exception (group=0x41b6eda0) 03-17 15:41:50.444 6484-6484/com.b2.assyrian.activity I/Choreographer﹕ Skipped 30 frames! The application may be doing too much work on its main thread. 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity W/System.err﹕ java.lang.OutOfMemoryError 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity W/System.err﹕ at android.graphics.Bitmap.nativeCreate(Native Method) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity W/System.err﹕ at android.graphics.Bitmap.createBitmap(Bitmap.java:929) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity W/System.err﹕ at android.graphics.Bitmap.createBitmap(Bitmap.java:902) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity W/System.err﹕ at android.graphics.Bitmap.createBitmap(Bitmap.java:834) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity W/System.err﹕ at com.commonsware.cwac.camera.ImageCleanupTask.run(ImageCleanupTask.java:121) 03-17 15:41:50.444 6484-6507/com.b2.assyrian.activity E/BufferQueue﹕ [unnamed-6484-0] dequeueBuffer: min undequeued buffer count (2) exceeded (dequeued=11 undequeudCount=0) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity W/System.err﹕ java.lang.OutOfMemoryError 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity W/System.err﹕ at android.graphics.Bitmap.nativeCreate(Native Method) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity W/System.err﹕ at android.graphics.Bitmap.createBitmap(Bitmap.java:929) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity W/System.err﹕ at android.graphics.Bitmap.createBitmap(Bitmap.java:902) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity W/System.err﹕ at android.graphics.Bitmap.createBitmap(Bitmap.java:834) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity W/System.err﹕ at com.commonsware.cwac.camera.ImageCleanupTask.run(ImageCleanupTask.java:121) 03-17 15:41:50.444 6484-7118/com.b2.assyrian.activity E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-661 Process: com.b2.assyrian.activity, PID: 6484 java.lang.OutOfMemoryError at android.graphics.Bitmap.nativeCreate(Native Method) at android.graphics.Bitmap.createBitmap(Bitmap.java:929) at android.graphics.Bitmap.createBitmap(Bitmap.java:902) at android.graphics.Bitmap.createBitmap(Bitmap.java:834) at com.commonsware.cwac.camera.ImageCleanupTask.run(ImageCleanupTask.java:121)

jaydeepw commented 9 years ago

As mentioned in the Getting Started setion, are you adding

android:largeHeap="true"

attribute to tag in AndroidManifest.xml?

sogwiz commented 9 years ago

you're right. I'm sorry - I misread that. Thank you for your quick reply :) It works great now on the Galaxy S4 after making the change you suggested

jaydeepw commented 9 years ago

:+1: