question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to load sampled bitmap

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
giangtranmlcommented, May 15, 2016

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

3reactions
manojkumar1412commented, Sep 12, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to load sampled bitmap: · Issue #416 - GitHub
Looking at the solution above where exactly did you change this code as the CropActivity still has control. This appears to be happening...
Read more >
Android - unable to use same URI twice when picking an image
Android - unable to use same URI twice when picking an image ... RuntimeException: Failed to load sampled bitmap: ...
Read more >
com.theartofdev.edmodo.cropper.BitmapUtils ... - Tabnine
Decode bitmap from stream using sampling to get bitmap with the requested limit. */ static BitmapSampled decodeSampledBitmap(Context context, Uri uri, ...
Read more >
Java.lang.runtimeexception: failed to read bitmap - CodeProject
I am trying to take a photo from the phone's camera, then pass it to tesseract engine and write the result on a...
Read more >
Android-Image-Cropper/cropper/src/main/java ... - Program Talk
Decode bitmap from stream using sampling to get bitmap with the requested limit. ... throw new RuntimeException( "Failed to load sampled bitmap: "...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found