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.

[BUG] - Null bitmap provided to OnCropImageCompleteListener

See original GitHub issue
  • Lib Version [e.g. 3.3.4-4.2.1]

Describe the bug I’ve upgraded the library and now I’m getting null bitmap in CropResult provided to the listener set using setOnCropImageCompleteListener. Interestingly isSuccessful is true and error is null.

The project is using CropImageView integration. The only change I needed to do when updating was to change getCroppedImageAsync() to croppedImageAsync().

The project is using Java 8, had issues upgrading it to Java 11. The files integrating with the library are in Kotlin. Not sure if it’s not Java 8 issue but I would expect any such issues to be more likely build-time issues, not such an odd runtime issue of bitmap being null right at the end of the flow.

To Reproduce Steps to reproduce the behavior:

  1. Use view integration
  2. setOnCropImageCompleteListener
  3. setImageBitmap
  4. croppedImageAsync()

Expected behavior cropResult.bitmap provided to the listener should not be null

Please help/advise.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
marekoidcommented, Apr 22, 2022

Maybe the sample was too basic. The view was not yet measured when I requested immediately croppedImageAsync() and perhaps that caused the error. Now added OK button to trigger croppedImageAsync() and I’m getting the same outcome as in the real project I’m working on. That’s what I see after calling croppedImageAsync(), the last 3 log entries are properties of CropImageView.CropResult received in the callback:

I/AIC: Try get URI for scope storage - content://
D/bitmap: null
D/error: null
D/isSuccessful: true
0reactions
marekoidcommented, Oct 28, 2022

I created a basic sample that reproduced the issue and linked to it in that comment.

Addressing the earlier question, it didn’t feel like worth looking for a work around really, just didn’t upgrade beyond the version that has introduced the regression.

I’m no loner working on the project were the bug prevented the library upgrade so will be unsubscribing from this thread but definitely if feels like something worth fixing for the active users of the library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android-Image-Cropper/CropImageView.java at master - GitHub
* Null if save cropped image was executed, no output requested or failure. */. public Bitmap getBitmap() {. return mBitmap ...
Read more >
Decoding Bitmap returns a null - android - Stack Overflow
This appears to be a common issue here in Stackoverflow, most appear to be errors relating to this bug. However, I think mine...
Read more >
com.theartofdev.edmodo.cropper.CropImageView Maven ...
private boolean mSizeChanged; /** * Temp URI used to save bitmap image to disk to ... null; setProgressBarVisibility(); OnCropImageCompleteListener listener ...
Read more >
some bitmap getConfig return null on sdk1.5r1 - Issue Tracker
badly with default usage of "BitmapFactory.decodeResource". Granted the bug can perhaps even be located in the build tools. This bug should not go ......
Read more >
Bitmap image = ((bitmapdrawable) imageview.getdrawable ...
You need to effectively reset it before loading a new uri. simply try. Java. imageView.setImageURI(null); ...
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