AndroidScannerDemo icon indicating copy to clipboard operation
AndroidScannerDemo copied to clipboard

Unable to save the capturing and crop image

Open amarpulli1994 opened this issue 8 years ago • 4 comments

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.

amarpulli1994 avatar Aug 20 '17 09:08 amarpulli1994

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.

vikasWri avatar Aug 25 '17 12:08 vikasWri

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

jay007minz avatar Jan 04 '18 15:01 jay007minz

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

ajay1295 avatar Jan 04 '18 17:01 ajay1295

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

nilasissen avatar Jul 02 '18 13:07 nilasissen