Failed to load sampled bitmap
See original GitHub issueI’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?
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (3 by maintainers)
Top GitHub 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