在创建图片位图时发生崩溃 (x + width 必须 <= bitmap.width())
Hi uCrop 团队! 我使用以下代码集成了 uCrop: val sourceUri = data.data val destinationUri = Uri.fromFile(File(getCacheDir(), "photoFromGallery.jpg")) val ratioX = cameraView.measuredWidth.toFloat() val ratioY = cameraView.measuredHeight.toFloat() val options = UCrop.Options() options.setToolbarColor(ContextCompat.getColor(context, R.color.gallery_primary)) options.setStatusBarColor(ContextCompat.getColor(context, R.color.gallery_dark)) options.setToolbarTitle(context.getString(R.string.gallery_edit_photo)) UCrop.of(sourceUri, destinationUri) .withAspectRatio(ratioX, ratioY) .withMaxResultSize(MAX_PHOTO_SIZE, MAX_PHOTO_SIZE) .withOptions(options) .start(context, this) 它在大多数情况下都运行正常。谢谢! 但是我们在 crashlytics 中发现了以下错误(每周大约 30 次): 发生在 java.lang.IllegalArgumentException: x + width must be <= bitmap.width() 中。 这在源文件 152 行中引发。 这在源文件 95 行中执行。 这在源文件 35 行中执行。 这在源文件 237 行中执行。 这在源文件 243 行中执行。 这在源文件 1133 行中执行。 这在源文件 607 行中执行。 这在源文件 762 行中执行。 我们不确定如何重现此错误。 你能否修复它? 也许我可以修改客户端代码来避免此错误? uCrop 版本 2.2.1。 图片来源: https://user-images.githubusercontent.com/4159785/38839758-33c090a0-41aa-11e8-8013-b33ce71e33b4.png
内容来源: Yalantis/uCrop