Closed ruchikagoel7 closed 1 year ago
I also see the same issue, mostly on Samsung devices.
@dmarcs from what I can see, the error happens here on line 36: https://github.com/WebsiteBeaver/android-document-scanner/blob/7c540fac6ffde5ba5f87129f76a9a0221e36d8dd/documentscanner/src/main/java/com/websitebeaver/documentscanner/utils/ImageUtil.kt#L31-L37
It seems that Imgcodecs.imread(..)
returns null
on line 33, because filepath
is a "missing file, improper permissions, unsupported or invalid format".
Could be an invalid format used by samsung/motorola devices? Maybe worth adding a null check to avoid crashes?
@alexglazkov9 can you please log the filepath, so we can see if it's an invalid format? Also can you add a check to see if the file exists, so we know if this is caused by a missing file?
May be a fix pull request #30
Apologies, Seems that this pull request is flawed maybe someone can improve upon
Fixed in https://github.com/WebsiteBeaver/android-document-scanner/pull/33 by making sure image isn't empty before calling cvtColor
. If it is try reading image without OpenCV.
Getting this crash for multiple users Android build tools: 4.1.0 targetsdk 33