HBiSoft / PickiT

An Android library that returns real paths from Uri's
MIT License
292 stars 54 forks source link

Android 12 > open failed: EACCES (Permission denied) #55

Closed AshishCodEx closed 1 year ago

AshishCodEx commented 2 years ago

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/PaymentReceipt21748557.pdf , wasDriveFile: false, wasUnknownProvider: false

W/System.err: java.io.FileNotFoundException: /storage/emulated/0/Download/PaymentReceipt21748557.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)

stale[bot] commented 2 years ago

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.

HBiSoft commented 1 year ago

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.

viktorilievski commented 1 year ago

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 READMEDIA* 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:_