The solution to the problem that the mobile phone cannot access the "xxx" directory (Android 11 and above grant file management permissions)

foreword

Android 11 has changed the previous Android system's rules for file management. On Android 11, reading and writing files has become a special permission. By default, the application can only read and write its own directory /android/data/package name, which leads us to modify the content in a file, but we do not have read and write permissions. This article mainly provides a solution - root+adb.

text

Enter adb+ROOT permission to open

We enter the adb shell and use the su command to switch to root privileges.

The operation under adb is very similar to the command line operation under ubuntu, and it is more convenient to operate.

File permission modification

So, referring to the command line operation under ubuntu, how should we change the permissions of the file?

That's right, just use the chmod command (here I directly chmod 777 the file name).

As for the location of the file you want to modify, if it is the external storage that comes with the phone, it is generally in the location of /storage/emulated/0/Android/data/packagename/files. For other locations, refer to the Android storage directory structure to know the file location.

It is recommended to cd in first to confirm whether the file location is correct, and if it is correct, execute the chmod command.

After the permissions are modified, we can directly open the file on the mobile phone or emulator and modify the file content.

Guess you like

Origin blog.csdn.net/weixin_51450600/article/details/130800711