更新时间:2022-02-19 21:30:48
这可能对您有所帮助.在 sdcard 上写入文件时,我遇到了同样的问题.我已经设置了写入文件所需的所有权限,但我使用了如下所示的文件对象:
This may help you. I face the same issue when writing the file on sdcard. I have set all required permission to write the file but I used the file object like below:
错误:
File myFile = new File(Environment.getExternalStorageDirectory().getAbsoluteFile()+fileName);
正确:
File myFile = new File(Environment.getExternalStorageDirectory().getAbsoluteFile(), fileName);
那说明路径不对.