lingochamp / lingochamp/FileDownloader

在大部分Android 9上不能在SD卡上创建文件

Open
#1,294 3 comments 1 reaction 1 assignee View on GitHub

@rantianhua is already working on this.

Since Oct 30, 2019.

question
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.