zetbaitsu / Compressor

An android image compression library.
7.08k stars 963 forks source link

error #4

Closed xiyanglove closed 8 years ago

xiyanglove commented 8 years ago

java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at id.zelory.compressor.ImageUtil.getScaledBitmap(ImageUtil.java:96) at id.zelory.compressor.ImageUtil.compressImage(ImageUtil.java:128) at id.zelory.compressor.Compressor.compressToFile(Compressor.java:43) at com.rxjr.rxcd.beta.utils.CompressUtil.doInBackground(CompressUtil.java:48) at com.rxjr.rxcd.beta.utils.CompressUtil.doInBackground(CompressUtil.java:21) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237)

zetbaitsu commented 8 years ago

android.graphics.Bitmap.getWidth()' on a null object reference the bitmap is null, make sure you passed the valid image file.

xiyanglove commented 8 years ago

thank you

xiyanglove commented 8 years ago

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:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.OutOfMemoryError: Failed to allocate a 6220812 byte allocation with 1216520 free bytes and 1188KB until OOM at dalvik.system.VMRuntime.newNonMovableArray(Native Method) at android.graphics.Bitmap.nativeCreate(Native Method) at android.graphics.Bitmap.createBitmap(Bitmap.java:843) at android.graphics.Bitmap.createBitmap(Bitmap.java:820) at android.graphics.Bitmap.createBitmap(Bitmap.java:740) at id.zelory.compressor.ImageUtil.getScaledBitmap(ImageUtil.java:111) at id.zelory.compressor.ImageUtil.compressImage(ImageUtil.java:128) at id.zelory.compressor.Compressor.compressToFile(Compressor.java:43)