Open RomanTsarou opened 1 year ago
I wonder if this happens because the photo file size is too big. Can you try to decrease DocumentScannerExtra.EXTRA_CROPPED_IMAGE_QUALITY, and see if this still happens?
Hi, I reproduce this issue. I ugpraded to the 1.3.5 version after having this issue: https://github.com/WebsiteBeaver/android-document-scanner/issues/29 This one is solved, but only to fall on this new one :smile: It might be related?
I guess it can fix the problem: https://stackoverflow.com/questions/8442316/bitmap-is-returning-null-from-bitmapfactory-decodefilefilename.
I implemented the following PR in our app, but it seems that it doesnt help
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at com.websitebeaver.documentscanner.utils.ImageUtil.getImageMatrixFromFilePath(ImageUtil.java:68) at com.websitebeaver.documentscanner.utils.ImageUtil.getImageFromFilePath(ImageUtil.java:86) at com.websitebeaver.documentscanner.DocumentScannerActivity$cameraUtil$1.invoke(DocumentScannerActivity.java:88) at com.websitebeaver.documentscanner.DocumentScannerActivity$cameraUtil$1.invoke(DocumentScannerActivity.java:75) at com.websitebeaver.documentscanner.utils.CameraUtil.startForResult$lambda-0(CameraUtil.java:41) at androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:418) at androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:375) at androidx.activity.ComponentActivity.onActivityResult(ComponentActivity.java:819) at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:164) at android.app.Activity.dispatchActivityResult(Activity.java:8192) at android.app.ActivityThread.deliverResults(ActivityThread.java:4965) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4292) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4338) at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2057) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7649) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:503) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
I guess it can fix the problem: https://stackoverflow.com/questions/8442316/bitmap-is-returning-null-from-bitmapfactory-decodefilefilename.