简体   繁体   中英

Android write to secondary external storage (Permission denied)

When I am trying to write to a file in secondary external storage (SD Card), I am getting the following error:

java.io.FileNotFoundException: /storage/70F7-83E4/file.txt (Permission denied)

I have added the following permissions to my manifest:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

I am also requesting permission at runtime. I have also downgraded from SDK 30 to SDK 28 and also tried adding the following to manifest file:

 android:requestLegacyExternalStorage="true"

I don't understand what I am doing wrong, but I am still unable to write to secondary external storage (SD Card).

Removable micro SD cards are not writable since Android Kitkat.

Except for one app specific directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM