Issue When Selecting Images From 'Downloads' Folder On Some Devices
tgbmoseswebb opened this issue · 8 comments
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
}
}
had the same
@tgbmoseswebb @corrado4eyes Did you guys added android:requestLegacyExternalStorage="true" in manifest file?
Yes I have added in manifest.
Yes...
- Device: Huawei P9 Lite
- Lib version: 1.7.1
Tried on Google Pixel 3XL and the problem is not there
Issue remains on Google Pixel 2 API 28 . Did you try on API 28 <?
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
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)
```