问题
adb授权读写权限,命令如下,apk读写文件时依然报错 Permission denied
adb shell pm grant [apk_pkg] android.permission.WRITE_EXTERNAL_STORAGE
adb shell pm grant [apk_pkg] android.permission.READ_EXTERNAL_STORAGE
原因
android10以上 android的文件管理系统有了更改 读写不可以用绝对路径了 要用包路径去读写 如果还用绝对路径去读写 就会出错
解决
设置requestLegacyExternalStorage
将android版本调为小于等于10,且将manifest清单中标记requestLegacyExternalStorage 为true