biokys / cropimage

Replacement for deprecated official Android crop image function
555 stars 292 forks source link

java.lang.RuntimeException: Canvas: trying to use a recycled bitmap #14

Open JP24 opened 11 years ago

JP24 commented 11 years ago

Hi, Please help. I am running the sample project which came with the library, I am using Samsung Galaxy S2 - Skyrocket with Android 4.1.2 So I am getting this error (Canvas: trying to use a recycled bitmap) only at the first launch and first click on "Take picture". so once I take picture then instead of start crop intent the app crashes. this error never comes back unless I uninstall app from device and re launch it after new installation.

Following is the error I am getting:

08-22 22:59:33.075: E/AndroidRuntime(14947): FATAL EXCEPTION: Thread-47491 08-22 22:59:33.075: E/AndroidRuntime(14947): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@421fd9b0 08-22 22:59:33.075: E/AndroidRuntime(14947): at android.graphics.Canvas.throwIfRecycled(Canvas.java:1026) 08-22 22:59:33.075: E/AndroidRuntime(14947): at android.graphics.Canvas.drawBitmap(Canvas.java:1096) 08-22 22:59:33.075: E/AndroidRuntime(14947): at android.graphics.Bitmap.createBitmap(Bitmap.java:604) 08-22 22:59:33.075: E/AndroidRuntime(14947): at eu.janmuller.android.simplecropimage.CropImage$1.prepareBitmap(CropImage.java:572) 08-22 22:59:33.075: E/AndroidRuntime(14947): at eu.janmuller.android.simplecropimage.CropImage$1.run(CropImage.java:578) 08-22 22:59:33.075: E/AndroidRuntime(14947): at eu.janmuller.android.simplecropimage.CropImage$6.run(CropImage.java:285) 08-22 22:59:33.075: E/AndroidRuntime(14947): at eu.janmuller.android.simplecropimage.Util$BackgroundJob.run(Util.java:175) 08-22 22:59:33.075: E/AndroidRuntime(14947): at java.lang.Thread.run(Thread.java:856)

Please help. Thanks!

marutib commented 11 years ago

Got similar error in my Crashes log in play store

java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@411c2b60 at android.graphics.Canvas.throwIfRecycled(Canvas.java:1038) at android.graphics.Canvas.drawBitmap(Canvas.java:1110) at android.graphics.Bitmap.createBitmap(Bitmap.java:569) at eu.janmuller.android.simplecropimage.CropImage$1.prepareBitmap(CropImage.java:577) at eu.janmuller.android.simplecropimage.CropImage$1.run(CropImage.java:583) at eu.janmuller.android.simplecropimage.CropImage$6.run(CropImage.java:291) at eu.janmuller.android.simplecropimage.Util$BackgroundJob.run(Util.java:175) at java.lang.Thread.run(Thread.java:856)

fvermeulen commented 11 years ago

Has anyone a solution?

I got the same error on a Samsung Galaxy S2 in line 571

571: return Bitmap.createBitmap(mBitmap, 0, 0, mBitmap.getWidth(), mBitmap.getHeight(), matrix, true);

amenboy commented 10 years ago

Please help me! 03-29 17:55:22.810: E/AndroidRuntime(8345): FATAL EXCEPTION: Thread-523 03-29 17:55:22.810: E/AndroidRuntime(8345): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@b394ede0 03-29 17:55:22.810: E/AndroidRuntime(8345): at android.graphics.Canvas.throwIfRecycled(Canvas.java:1038) 03-29 17:55:22.810: E/AndroidRuntime(8345): at android.graphics.Canvas.drawBitmap(Canvas.java:1110) 03-29 17:55:22.810: E/AndroidRuntime(8345): at android.graphics.Bitmap.createBitmap(Bitmap.java:569) 03-29 17:55:22.810: E/AndroidRuntime(8345): at eu.janmuller.android.simplecropimage.CropImage$1.prepareBitmap(CropImage.java:572) 03-29 17:55:22.810: E/AndroidRuntime(8345): at eu.janmuller.android.simplecropimage.CropImage$1.run(CropImage.java:578) 03-29 17:55:22.810: E/AndroidRuntime(8345): at eu.janmuller.android.simplecropimage.CropImage$6.run(CropImage.java:285) 03-29 17:55:22.810: E/AndroidRuntime(8345): at eu.janmuller.android.simplecropimage.Util$BackgroundJob.run(Util.java:175) 03-29 17:55:22.810: E/AndroidRuntime(8345): at java.lang.Thread.run(Thread.java:856)

raphaelbgr commented 9 years ago

Temporarely fixed by reinstantiating the last screen, isntead of trying to go back to it.