lingochamp / FileDownloader

Multitask、MultiThread(MultiConnection)、Breakpoint-resume、High-concurrency、Simple to use、Single/NotSingle-process
Apache License 2.0
11.04k stars 2.2k forks source link

android11 下载会报 Operation not permitted v1.7.7 #1375

Open salangheee opened 3 years ago

salangheee commented 3 years ago

Before Issue

  1. Please search on the Issues
  2. Please search on the wiki
  3. Please set FileDownloadLog.NEED_LOG=true and review the Logcat output from main process and :filedownloader process ( pay attention to Warn and Error level logcat)

Issue

  1. What problem do you get?
  2. Which version of FileDownloader are you using when you produce such problem?
  3. How to reproduce such problem?
  4. Do you set FileDownloadLog.NEED_LOG=true?
  5. Could you please reproduce this problem and provide all main process and :filedownloader process logcat
  6. Can you fix it by yourself and request PR, if not, what's problem do you get when you try to fix it

P.S. If you don't know how to get :filedownloader process, it's recommended to using pidcat to just filter all your application logcat, or define process.non-separate=true on filedownloader.properties


请在Issue前认真的跟进上面提到的建议,这样将可以极大的加快你遇到问题的处理。

a13568080388 commented 3 years ago

安卓存储权限在6.0后变成危险权限,在安卓11后变成特殊权限,需要以activity展示给用户看,需要: 1、升级targetSdkVersion和compileSdkVersion为30; 2、清单权限: manifest增加uses-permission: android:name="android.permission.READ_EXTERNAL_STORAGE android.permission.WRITE_EXTERNAL_STORAGE android.permission.MANAGE_EXTERNAL_STORAGE 3、动态申请: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { // 先判断有没有权限 if (Environment.isExternalStorageManager()) { //todo } else { Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION); intent.setData(Uri.parse("package:" + context.getPackageName())); startActivityForResult(intent, REQUEST_CODE); } } 回调: @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { if (Environment.isExternalStorageManager()) { //todo } else { //toast 存储权限获取失败 } } } //<R的跟以前的一样了

ChenXin770 commented 3 years ago

我也遇到这个问题了,不知道咋解决

ibrahimlee commented 2 years ago

Characters like /.?!| create this problem. Avoid the occurrence of such characters in the file name.

.setPath(fileName)