Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue When Selecting Images From 'Downloads' Folder On Some Devices #86

Closed
tgbmoseswebb opened this issue May 17, 2020 · 8 comments
Closed
Milestone

Comments

@tgbmoseswebb
Copy link

The issue is still there on some mobile phones. Only for downloaded images.

  • Library Version - 1.7.1
  • Samsung A10

Stack trace
E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/Download/image-1.jpg (No such file or directory)

java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65560, result=-1, data=Intent { dat=file:///storage/emulated/0/Download/image-1.jpg (has extras) }} to activity

Code
ImagePicker.with(this)
.start { resultCode, data ->
if (resultCode == Activity.RESULT_OK) {
selectedPhotoUri = data?.data
imageView.setImageURI(selectedPhotoUri)
//OTHER WORK
} else if (resultCode == ImagePicker.RESULT_ERROR) {
//ERROR
}
}

@corrado4eyes
Copy link

had the same

@Dhaval2404
Copy link
Owner

@tgbmoseswebb @corrado4eyes Did you guys added android:requestLegacyExternalStorage="true" in manifest file?

@tgbmoseswebb
Copy link
Author

Yes I have added in manifest.

@corrado4eyes
Copy link

corrado4eyes commented May 21, 2020

Yes...

  • Device: Huawei P9 Lite
  • Lib version: 1.7.1

@corrado4eyes
Copy link

corrado4eyes commented May 21, 2020

Tried on Google Pixel 3XL and the problem is not there

@tgbmoseswebb
Copy link
Author

Issue remains on Google Pixel 2 API 28 . Did you try on API 28 <?

@corrado4eyes
Copy link

corrado4eyes commented May 26, 2020

The huawei I mentioned use API 24. Edit: Just tried with API 27 and 26 on Google pixel 2 (emulator) and it works... At this point, I don't think the problem is API specific

@Dhaval2404 Dhaval2404 modified the milestones: v2.0, v1.8 Dec 18, 2020
Dhaval2404 added a commit that referenced this issue Dec 21, 2020
@build3r
Copy link

build3r commented Mar 14, 2022

Having similar issue in lib v2.1
Device info:
Brand:Xiaomi
Model:Redmi Note 7
Operating System
Version:Android 10
Orientation: Portrait
RAM free: 840.25 MB
Disk free: 19.34 GB

Fatal Exception: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=4261, result=-1, data=Intent { dat=content://com.android.providers.media.documents/document/image:30185 flg=0x43 }} to activity {in.onionlife.karmalife/com.github.dhaval2404.imagepicker.ImagePickerActivity}: java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:4960)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:5001)
       at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2047)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:224)
       at android.app.ActivityThread.main(ActivityThread.java:7590)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Caused by java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
       at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:149)
       at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderProxy.java:705)
       at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1702)
       at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1518)
       at android.content.ContentResolver.openInputStream(ContentResolver.java:1202)
       at com.github.dhaval2404.imagepicker.util.FileUtil.getImageResolution(FileUtil.java:94)
       at com.github.dhaval2404.imagepicker.provider.CompressionProvider.isCompressionRequired(CompressionProvider.kt:80)
       at com.github.dhaval2404.imagepicker.ImagePickerActivity.setImage(ImagePickerActivity.kt:129)
       at com.github.dhaval2404.imagepicker.provider.GalleryProvider.handleResult(GalleryProvider.java:75)
       at com.github.dhaval2404.imagepicker.provider.GalleryProvider.onActivityResult(GalleryProvider.java:61)
       at com.github.dhaval2404.imagepicker.ImagePickerActivity.onActivityResult(ImagePickerActivity.kt:110)
       at android.app.Activity.dispatchActivityResult(Activity.java:8249)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:4953)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:5001)
       at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2047)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:224)
       at android.app.ActivityThread.main(ActivityThread.java:7590)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
       ```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants