Android-Image-Cropper: Failed to load sampled bitmap

I’m getting some reports of user’s that are unable to set a photo, and have this log message:

Fatal Exception: java.lang.RuntimeException: Failed to load sampled bitmap at com.theartofdev.edmodo.cropper.BitmapUtils.decodeSampledBitmapRegion(BitmapUtils.java:178) at com.theartofdev.edmodo.cropper.BitmapUtils.cropBitmap(BitmapUtils.java:191) at com.theartofdev.edmodo.cropper.CropImageView.getCroppedImage(CropImageView.java:456) at com.rogertalk.roger.ui.screens.ImageCropActivity.cropImagePressed(ImageCropActivity.kt:99) at com.rogertalk.roger.ui.screens.ImageCropActivity.access$cropImagePressed(ImageCropActivity.kt:28) at com.rogertalk.roger.ui.screens.ImageCropActivity$setupUI$1.onClick(ImageCropActivity.kt:74) at android.view.View.performClick(View.java:4856) at android.view.View$PerformClick.run(View.java:19956) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:211) at android.app.ActivityThread.main(ActivityThread.java:5373) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815) Caused by java.io.IOException: Image failed to decode using JPEG decoder at android.graphics.BitmapRegionDecoder.nativeNewInstance(BitmapRegionDecoder.java) at android.graphics.BitmapRegionDecoder.newInstance(BitmapRegionDecoder.java:124) at com.theartofdev.edmodo.cropper.BitmapUtils.decodeSampledBitmapRegion(BitmapUtils.java:172) at com.theartofdev.edmodo.cropper.BitmapUtils.cropBitmap(BitmapUtils.java:191) at com.theartofdev.edmodo.cropper.CropImageView.getCroppedImage(CropImageView.java:456) at com.rogertalk.roger.ui.screens.ImageCropActivity.cropImagePressed(ImageCropActivity.kt:99) at com.rogertalk.roger.ui.screens.ImageCropActivity.access$cropImagePressed(ImageCropActivity.kt:28) at com.rogertalk.roger.ui.screens.ImageCropActivity$setupUI$1.onClick(ImageCropActivity.kt:74) at android.view.View.performClick(View.java:4856) at android.view.View$PerformClick.run(View.java:19956) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:211) at android.app.ActivityThread.main(ActivityThread.java:5373) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)

It is happening on Android 5.0 and 5.1.1 so far. I myself cannot reproduce it, but know that this is making the app crash for those specific users. Any idea on what might be wrong?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

With gallery, everything is ok. But when i open camera to capture, I have the issue be like this: java.lang.RuntimeException: Failed to load sampled bitmap: file:///storage/emulated/0/MyDir/img_1463316925324.jpg. I’m using newest version

Facing this again in Android 11(SDK 30), similar to reported in https://github.com/ArthurHub/Android-Image-Cropper/issues/47#issuecomment-880879472

The issue is coming back again in Android 11 (SDK 30) and seems to affect mostly Samsung phones and Google pixel 3. Non of the above solutions worked! any tips? I am trying to solve for a week now but nothing so far.

I am still facing same issue in V 2.7.0. I am picking image from local storage.