lingochamp / lingochamp/FileDownloader
在大部分Android 9上不能在SD卡上创建文件
@rantianhua is already working on this.
Since Oct 30, 2019.
- Dominant language
- Java
- Stars
- 11.1k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
1. process.non-separate=true
2.在开始下载之前确保了WRITE_EXTERNAL_STORAGE的权限申请
3.在拿下载根目录时确保了文件可读 代码如下
```
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || !Environment.isExternalStorageRemovable()) {
File[] fs = context.getExternalFilesDirs(null);
if (fs != null && fs.length > 0) {
for (int i = fs.length - 1; i >= 0; i--) {
final File f = fs[i];
boolean flag = f == null || !f.exists() || !f.canRead() || !f.canWrite();
if (!flag) {
return f;
}
}
}
}
```
4.参考网上的建议在manifest添加了权限
```
```
但还是发生了不能在SD卡上创建文件
1. Create parent directory failed, please make sure you have permission to create file or directory on the path: /storage/3433-3031/Android/data/com.roadtour.outdoorsgb/files/RoadtourGB_maps
2. 使用的版本是1.7.6
3. 目前是用第三方工具在error回调方法里上传的
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.