Skip to content
This repository has been archived by the owner on May 30, 2021. It is now read-only.

java.lang.OutOfMemoryErrorFatal Exception: java.lang.RuntimeException An error occurred while executing doInBackground() #50

Closed
mikemike396 opened this issue Dec 20, 2017 · 4 comments
Assignees
Projects

Comments

@mikemike396
Copy link
Contributor

Getting this crash ->

Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground()
       at android.os.AsyncTask$3.done(AsyncTask.java:318)
       at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
       at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
       at java.util.concurrent.FutureTask.run(FutureTask.java:242)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
       at java.lang.Thread.run(Thread.java:762)
Caused by java.lang.OutOfMemoryError: Failed to allocate a 63701004 byte allocation with 16777216 free bytes and 44MB until OOM
       at dalvik.system.VMRuntime.newNonMovableArray(VMRuntime.java)
       at android.graphics.Bitmap.nativeCreate(Bitmap.java)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:977)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:948)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:879)
       at net.alhazmy13.mediapicker.Utility.compressAndRotateIfNeeded(Utility.java:94)
       at net.alhazmy13.mediapicker.Image.ImageActivity$CompressImageTask.doInBackground(ImageActivity.java:388)
       at net.alhazmy13.mediapicker.Image.ImageActivity$CompressImageTask.doInBackground(ImageActivity.java:351)
       at android.os.AsyncTask$2.call(AsyncTask.java:304)
       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
       at java.lang.Thread.run(Thread.java:762)

Location ->
Utility.java line 94
net.alhazmy13.mediapicker.Utility.compressAndRotateIfNeeded

Running this build ->
compile 'net.alhazmy13.MediaPicker:libary:2.4.0'

screen shot 2017-12-20 at 8 42 34 am

@alhazmy13
Copy link
Owner

Hi @mikemike396
Can you please add this line to your manifest under applications tag android:largeHeap="true"

  <application
      android:name=".ParaseApplication"
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme"
      android:largeHeap="true" >

@alhazmy13 alhazmy13 self-assigned this Dec 22, 2017
@alhazmy13 alhazmy13 added this to To Do in MediaPicker via automation Dec 22, 2017
@mikemike396
Copy link
Contributor Author

I added the larger heap setting to the manifest and redeployed. I will post back in a few days to see if it shows up again. Thanks again for the help!

@wisnukurniawan
Copy link

How the result bro @mikemike396 ?

@mikemike396
Copy link
Contributor Author

@wisnukurniawan looking great so far! The crash hasn’t appeared in the new version yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
MediaPicker
  
To Do
Development

No branches or pull requests

3 participants