as the android system continues to update, a lot of business code to follow the update, otherwise often unexpected errors will occur. For example, starting with Android Q(10), storage is partitioned. As a result, I have applied for the permission of Android.Permission.WRITE_EXTERNAL_STORAGE, but I still report open Failed: EACCES (Permission denied). You can only turn permissions on manually, and you can also use storage permissions.
without further ado, let’s talk about the solution first, then the principle. The solution is to add
to the manifest’s application tag
android:requestLegacyExternalStorage="true" 标识,问题便解决了。如图:
p>
here’s why: the Android Q file storage mechanism has been modified to sandbox mode, a bit like apple. APP can only access files in its own directory and public media files. Under AndroidQ, use the old file storage method. Android Q still USES READ_EXTERNAL_STORAGE
and WRITE_EXTERNAL_STORAGE
as storage related runtime permissions, but now access to external storage is limited even if these permissions are obtained.
android:requestLegacyExternalStorage="true" 的意思就是使用旧的存储策略,不使用androidQ的新策略。但这个不是长久之计,很快将会强制都使用新策略。最好的解决策略就是
1.需要长期保存并且卸载也不能删除的,使用公有目录
public directory: Downloads
Documents
Downloads Downloads Documents
Downloads Documents p> Downloads
Read More:
- Android has applied for permission and still prompts open failed: eacces (permission denied)
- Developing in Android java.net.SocketException : socket failed: eacces (permission denied) reported an error
- Unhandled rejection Error: EACCES: permission denied, open ‘/Users
- NPM ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’
- mac Error: EACCES: permission denied, mkdir ‘./cache’
- Unhandled rejection Error: EACCES: permission denied
- move_uploaded_file() failed to open stream: Permission denied
- ERROR: While executing gem … (Errno::EACCES) Permission denied @ dir_s_mkdir – /var/lib/gems
- [git] report error and solve cannot open.git/fetch_ HEAD: Permission denied
- Permission error: [errno 13] permission denied: ‘… ” xxx.pyd ‘
- Beeline connection hive2 reports an error permission denied
- Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’ npm ERR! at Error (native)
- error: cannot open .git/FETCH_ Head: permission denied resolved
- session_ start(): open(SESSION_ FILE, O_ Rdwr)) failed: processing of permission denied (13)
- PHP error Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error:
- php open(/var/lib/php/session/sess_4ofxxx, O_RDWR) failed: Permission denied (13)
- Solve the problem of permission after flutter package_ Handler failure
- ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied
- Git error: no permission remote: error: unable to unlink old ‘ README.md ‘ (Permission denied)
- Solutions for permission denied