Android-Image-Cropper: [BUG] - Null bitmap provided to OnCropImageCompleteListener

  • 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.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

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