jhansireddy / AndroidScannerDemo

ScanLibrary is an android document scanning library built on top of OpenCV, using the app you will be able to select the exact edges and crop the document accordingly from the selected 4 edges and change the perspective transformation of the cropped image.
MIT License
1.07k stars 473 forks source link

Unable to save the capturing and crop image #48

Open amarpulli1994 opened 7 years ago

amarpulli1994 commented 7 years ago

hello @nilasissen,

I am using your repository downloaded from https://github.com/nilasissen/AndroidScannerDemo . But here when i was capture image it doesn't save and it will not process for cropping image. I got some info through debugging see below, When I was run application for first time showing below error

Failed to insert image
                                                            java.io.FileNotFoundException: No such file or directory
                                                                at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:144)
                                                                at android.content.ContentProviderProxy.openAssetFile(ContentProviderNative.java:621)
                                                                at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:960)
                                                                at android.content.ContentResolver.openOutputStream(ContentResolver.java:702)
                                                                at android.content.ContentResolver.openOutputStream(ContentResolver.java:678)
                                                                at android.provider.MediaStore$Images$Media.insertImage(MediaStore.java:965)
                                                                at com.scanlibrary.Utils.getUri(Utils.java:23)
                                                                at com.scanlibrary.PickImageFragment.postImagePick(PickImageFragment.java:146)
                                                                at com.scanlibrary.PickImageFragment.onActivityResult(PickImageFragment.java:141)
                                                                at android.app.Activity.dispatchActivityResult(Activity.java:6494)
                                                                at android.app.ActivityThread.deliverResults(ActivityThread.java:3716)
                                                                at android.app.ActivityThread.handleSendResult(ActivityThread.java:3763)
                                                                at android.app.ActivityThread.-wrap16(ActivityThread.java)
                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1403)
                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                at android.os.Looper.loop(Looper.java:148)
                                                                at android.app.ActivityThread.main(ActivityThread.java:5443)
                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

Then again i am trying it will show below errors

08-20 14:35:17.604 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err: java.lang.NullPointerException: uri
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at com.android.internal.util.Preconditions.checkNotNull(Preconditions.java:60)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:922)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:865)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at com.scanlibrary.PickImageFragment.getBitmap(PickImageFragment.java:156)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at com.scanlibrary.PickImageFragment.onActivityResult(PickImageFragment.java:128)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at android.app.Activity.dispatchActivityResult(Activity.java:6494)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at android.app.ActivityThread.deliverResults(ActivityThread.java:3716)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3107)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3152)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4098)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at android.app.ActivityThread.-wrap15(ActivityThread.java)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1360)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at android.os.Looper.loop(Looper.java:148)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5443)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
08-20 14:35:17.614 3428-3428/com.fueblabs.smarthome.cheque_scandemo W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

How I could resolve this issue. System Configurations: Android Tool : Android studio 2.3.3 Java : Java 1.8 os : Windows 10 (64 bit).

Thanks and Regards,

Amar.

vikasWri commented 6 years ago

Hey, I can help you.

This is happening because of provider. can you please tell me in which device you are facing this issue and can u snippet your Manifest file here.

jay007minz commented 6 years ago

Hi, I am facing the same issue in Samsung Galaxy J2 - SM-J200G. Android version 5.1.1.

ajay1295 commented 6 years ago

I have same problem in galaxy J7. In emulator and other moto devices its working fine.

nilasissen commented 6 years ago

@amarpulli544 sorry bro it was long back I don't remember. but as far as I can remember my repo was perfectly working. maybe it's a device specific issue i have tested it mostly with moto devices.