HBiSoft / PickiT

An Android library that returns real paths from Uri's

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android 12 > open failed: EACCES (Permission denied)

AshishCodEx opened this issue · comments

Could not open file stream which is selected from downloads on OnePlus Nord OS version 12,
PickiTonCompleteListener returns wasSuccessful=true & also returns file path.
android:requestLegacyExternalStorage="true" is also set in manifest file

Log:

PickiTonCompleteListener: selectedFilePath: /storage/emulated/0/Download/PaymentReceipt_21748557_.pdf , wasDriveFile: false, wasUnknownProvider: false

W/System.err: java.io.FileNotFoundException: /storage/emulated/0/Download/PaymentReceipt_21748557_.pdf: open failed: EACCES (Permission denied)
W/System.err: at libcore.io.IoBridge.open(IoBridge.java:574)
W/System.err: at java.io.FileInputStream.(FileInputStream.java:160)
W/System.err: at com.checkup.app.authenticationAndProfile.AddChildProfileActivity.convertImageFileToBase64(AddChildProfileActivity.kt:641)
W/System.err: at com.checkup.app.authenticationAndProfile.AddChildProfileActivity$PickiTonCompleteListener$1.invoke(AddChildProfileActivity.kt:1103)
W/System.err: at com.checkup.app.authenticationAndProfile.AddChildProfileActivity$PickiTonCompleteListener$1.invoke(AddChildProfileActivity.kt:1102)
W/System.err: at org.jetbrains.anko.AsyncKt$doAsync$1.invoke(Async.kt:143)
W/System.err: at org.jetbrains.anko.AsyncKt$doAsync$1.invoke(Unknown Source:0)
W/System.err: at org.jetbrains.anko.AsyncKt$sam$java_util_concurrent_Callable$0.call(Unknown Source:2)
W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:264)
W/System.err: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
W/System.err: at java.lang.Thread.run(Thread.java:1012)
W/System.err: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
W/System.err: at libcore.io.Linux.open(Native Method)
W/System.err: at libcore.io.ForwardingOs.open(ForwardingOs.java:563)
W/System.err: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:274)
W/System.err: at libcore.io.ForwardingOs.open(ForwardingOs.java:563)
W/System.err: at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8094)
W/System.err: at libcore.io.IoBridge.open(IoBridge.java:560)

it be reproduced in demo app

PickiT version: 2.0.5

Device information

OnePlus Nord AC2001
SDK version: 31 (Android 12)

commented

This issue has been automatically marked as stale because it has not had activity in the last 14 days. It will be closed if no further activity occurs within the next 3 days. Thank you for your contributions.

Apologies for the late reply. You have probably moved on from this by now. If not, please confirm if you have tested using the demo application. I just did a test on the same device and was not able to reproduce this.

This issue persists in the demo app. The target and compile sdk version is set to 30. Change it to 33 and you will recreate it. Google has announced that apps targeting API 30 or higher must use Scoped Storage https://source.android.com/docs/core/storage/scoped

For Android 13 you must use a new permission called READ_MEDIA_* as explained here -> https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions

If your app targets Android 13 or higher and needs to access media files that other apps have created, you must request one or more of the following granular media permissions instead of the READ_EXTERNAL_STORAGE permission: