Closed iruizmar closed 7 months ago
It looks like this issue occurs on Android versions <= 10.
The image is displayed below the "Image picked" text
The image is not displayed
Here is the error stacktrace:
2024-02-07 16:55:06.416 21734-21734 System.err com.mohamedrejeb.calf.android W java.io.FileNotFoundException: /storage/emulated/0/Download/Eopsaltria_australis_-_Mogo_Campground.jpg: open failed: EACCES (Permission denied)
2024-02-07 16:55:06.420 21734-21734 System.err com.mohamedrejeb.calf.android W at libcore.io.IoBridge.open(IoBridge.java:496)
2024-02-07 16:55:06.420 21734-21734 System.err com.mohamedrejeb.calf.android W at java.io.FileInputStream.<init>(FileInputStream.java:159)
2024-02-07 16:55:06.420 21734-21734 System.err com.mohamedrejeb.calf.android W at kotlin.io.FilesKt__FileReadWriteKt.readBytes(FileReadWrite.kt:63)
2024-02-07 16:55:06.420 21734-21734 System.err com.mohamedrejeb.calf.android W at com.mohamedrejeb.calf.io.KmpFile_androidKt.readByteArray(KmpFile.android.kt:14)
2024-02-07 16:55:06.420 21734-21734 System.err com.mohamedrejeb.calf.android W at com.mohamedrejeb.calf.sample.ui.ImagePickerScreenKt$ImagePickerScreen$singlePickerLauncher$1$1.invoke(ImagePickerScreen.kt:38)
2024-02-07 16:55:06.421 21734-21734 System.err com.mohamedrejeb.calf.android W at com.mohamedrejeb.calf.sample.ui.ImagePickerScreenKt$ImagePickerScreen$singlePickerLauncher$1$1.invoke(ImagePickerScreen.kt:35)
2024-02-07 16:55:06.421 21734-21734 System.err com.mohamedrejeb.calf.android W at com.mohamedrejeb.calf.picker.FilePickerLauncher_androidKt$pickSingleVisualMedia$singlePhotoPickerLauncher$1.invoke(FilePickerLauncher.android.kt:79)
2024-02-07 16:55:06.421 21734-21734 System.err com.mohamedrejeb.calf.android W at com.mohamedrejeb.calf.picker.FilePickerLauncher_androidKt$pickSingleVisualMedia$singlePhotoPickerLauncher$1.invoke(FilePickerLauncher.android.kt:75)
2024-02-07 16:55:06.421 21734-21734 System.err com.mohamedrejeb.calf.android W at androidx.activity.compose.ActivityResultRegistryKt$rememberLauncherForActivityResult$1.invoke$lambda$0(ActivityResultRegistry.kt:106)
2024-02-07 16:55:06.421 21734-21734 System.err com.mohamedrejeb.calf.android W at androidx.activity.compose.ActivityResultRegistryKt$rememberLauncherForActivityResult$1.$r8$lambda$CrhP0xb3HsgP_dLwJEFAtzTwPms(Unknown Source:0)
2024-02-07 16:55:06.421 21734-21734 System.err com.mohamedrejeb.calf.android W at androidx.activity.compose.ActivityResultRegistryKt$rememberLauncherForActivityResult$1$$ExternalSyntheticLambda0.onActivityResult(Unknown Source:2)
2024-02-07 16:55:06.421 21734-21734 System.err com.mohamedrejeb.calf.android W at androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:414)
2024-02-07 16:55:06.421 21734-21734 System.err com.mohamedrejeb.calf.android W at androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:371)
2024-02-07 16:55:06.421 21734-21734 System.err com.mohamedrejeb.calf.android W at androidx.activity.ComponentActivity.onActivityResult(ComponentActivity.java:845)
2024-02-07 16:55:06.421 21734-21734 System.err com.mohamedrejeb.calf.android W at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:164)
2024-02-07 16:55:06.421 21734-21734 System.err com.mohamedrejeb.calf.android W at android.app.Activity.dispatchActivityResult(Activity.java:8110)
2024-02-07 16:55:06.421 21734-21734 System.err com.mohamedrejeb.calf.android W at android.app.ActivityThread.deliverResults(ActivityThread.java:4838)
2024-02-07 16:55:06.421 21734-21734 System.err com.mohamedrejeb.calf.android W at android.app.ActivityThread.handleSendResult(ActivityThread.java:4886)
2024-02-07 16:55:06.424 21734-21734 System.err com.mohamedrejeb.calf.android W at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
2024-02-07 16:55:06.424 21734-21734 System.err com.mohamedrejeb.calf.android W at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
2024-02-07 16:55:06.424 21734-21734 System.err com.mohamedrejeb.calf.android W at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
2024-02-07 16:55:06.424 21734-21734 System.err com.mohamedrejeb.calf.android W at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
2024-02-07 16:55:06.424 21734-21734 System.err com.mohamedrejeb.calf.android W at android.os.Handler.dispatchMessage(Handler.java:107)
2024-02-07 16:55:06.425 21734-21734 System.err com.mohamedrejeb.calf.android W at android.os.Looper.loop(Looper.java:214)
2024-02-07 16:55:06.425 21734-21734 System.err com.mohamedrejeb.calf.android W at android.app.ActivityThread.main(ActivityThread.java:7356)
2024-02-07 16:55:06.425 21734-21734 System.err com.mohamedrejeb.calf.android W at java.lang.reflect.Method.invoke(Native Method)
2024-02-07 16:55:06.425 21734-21734 System.err com.mohamedrejeb.calf.android W at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
2024-02-07 16:55:06.425 21734-21734 System.err com.mohamedrejeb.calf.android W at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
2024-02-07 16:55:06.431 21734-21734 System.err com.mohamedrejeb.calf.android W Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
2024-02-07 16:55:06.431 21734-21734 System.err com.mohamedrejeb.calf.android W at libcore.io.Linux.open(Native Method)
2024-02-07 16:55:06.431 21734-21734 System.err com.mohamedrejeb.calf.android W at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
2024-02-07 16:55:06.431 21734-21734 System.err com.mohamedrejeb.calf.android W at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
2024-02-07 16:55:06.431 21734-21734 System.err com.mohamedrejeb.calf.android W at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
2024-02-07 16:55:06.431 21734-21734 System.err com.mohamedrejeb.calf.android W at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7255)
2024-02-07 16:55:06.431 21734-21734 System.err com.mohamedrejeb.calf.android W at libcore.io.IoBridge.open(IoBridge.java:482)
2024-02-07 16:55:06.432 21734-21734 System.err com.mohamedrejeb.calf.android W ... 27 more
This should be fixed in the next release.
Now in android target KmpFile
is a wrapper around Uri
instead of File
, because I was using a code to convert the Uri
to a File
which was not working all the time.
@youssaka I think that your issue is related to permissions. EACCES (Permission denied)
Make sure that you have the correct permissions for reading files in your manifest file.
This should be fixed in the latest version 0.4.0
, feel free to reopen the issue if you still have problems.
Easily reproducible in the sample file picker screen, the list of received files is always empty. On iOS it's working as expected.