question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

saveDir didn't work

See original GitHub issue

when i set savedDir=/storage/emulated/0/Android/data/vn.hunghd.example/files
but files save to /storage/emulated/0/Download/Android-Programming-Cookbook.pdf

  • compileSdkVersion: 30
  • android version: 11
  • flutter_downloader: 1.7.0
  • flutter version: 2.5.0

my code

  Future<String?> _findLocalPath() async {
    var externalStorageDirPath;
    if (Platform.isAndroid) {
      try {
        // externalStorageDirPath = await AndroidPathProvider.downloadsPath;
        externalStorageDirPath = (await getExternalStorageDirectory())?.path;  //<-----------here
      } catch (e) {
        final directory = await getExternalStorageDirectory();
        externalStorageDirPath = directory?.path;
      }
    } else if (Platform.isIOS) {
      externalStorageDirPath = (await getApplicationDocumentsDirectory()).absolute.path;
    }
    return externalStorageDirPath;
  }

logs

[+5686 ms] W/WM-WorkSpec(22928): Backoff delay duration less than minimum value
[  +35 ms] D/DownloadWorker(22928): DownloadWorker{url=http://enos.itcollege.ee/~jpoial/allalaadimised/reading/Android-Programming-Cookbook.pdf,filename=null,savedDir=/storage/emulated/0/Android/data/vn.hunghd.example/files,header={"auth": "test_for_sql_encoding"},isResume=false
[   +1 ms] D/DownloadWorker(22928): Update notification: {notificationId: 5, title: http://enos.itcollege.ee/~jpoial/allalaadimised/reading/Android-Programming-Cookbook.pdf, status: 2, progress: 0}
[  +10 ms] D/DownloadWorker(22928): Open connection to http://enos.itcollege.ee/~jpoial/allalaadimised/reading/Android-Programming-Cookbook.pdf
[        ] D/DownloadWorker(22928): Headers = {"auth": "test_for_sql_encoding"}
[   +2 ms] I/flutter (22928): Background Isolate Callback: task (384f753e-2958-4526-9fbc-9d2b12641b9d) is in status (DownloadTaskStatus(2)) and process (0)
[   +5 ms] I/flutter (22928): UI Isolate Callback: [384f753e-2958-4526-9fbc-9d2b12641b9d, DownloadTaskStatus(2), 0]
[ +690 ms] D/DownloadWorker(22928): Response with redirection code
[        ] D/DownloadWorker(22928): Location = https://enos.itcollege.ee/~jpoial/allalaadimised/reading/Android-Programming-Cookbook.pdf
[        ] D/DownloadWorker(22928): New url: https://enos.itcollege.ee/~jpoial/allalaadimised/reading/Android-Programming-Cookbook.pdf
[        ] D/DownloadWorker(22928): Open connection to https://enos.itcollege.ee/~jpoial/allalaadimised/reading/Android-Programming-Cookbook.pdf
[   +1 ms] D/DownloadWorker(22928): Headers = {"auth": "test_for_sql_encoding"}
[+1332 ms] D/DownloadWorker(22928): Content-Type = application/pdf
[        ] D/DownloadWorker(22928): Content-Length = 8620159
[        ] D/DownloadWorker(22928): Charset = null
[        ] D/DownloadWorker(22928): Content-Disposition = null
[        ] D/DownloadWorker(22928): fileName = Android-Programming-Cookbook.pdf
[ +645 ms] D/DownloadWorker(22928): Update notification: {notificationId: 5, title: Android-Programming-Cookbook.pdf, status: 2, progress: 1}
[   +3 ms] I/flutter (22928): Background Isolate Callback: task (384f753e-2958-4526-9fbc-9d2b12641b9d) is in status (DownloadTaskStatus(2)) and process (1)
[        ] I/flutter (22928): UI Isolate Callback: [384f753e-2958-4526-9fbc-9d2b12641b9d, DownloadTaskStatus(2), 1]
[+1891 ms] D/DownloadWorker(22928): Update notification: {notificationId: 5, title: Android-Programming-Cookbook.pdf, status: ...
...
...
...
[        ] I/flutter (22928): UI Isolate Callback: [384f753e-2958-4526-9fbc-9d2b12641b9d, DownloadTaskStatus(2), 100]
[  +18 ms] D/DownloadWorker(22928): File downloaded (/storage/emulated/0/Download/Android-Programming-Cookbook.pdf)
[   +3 ms] D/DownloadWorker(22928): Setting an intent to open the file /storage/emulated/0/Download/Android-Programming-Cookbook.pdf               //<<<<<<<<<<------------------------here


[        ] I/flutter (22928): Background Isolate Callback: task (384f753e-2958-4526-9fbc-9d2b12641b9d) is in status (DownloadTaskStatus(3)) and process (100)
[   +1 ms] D/DownloadWorker(22928): Update too frequently!!!!, but it is the final update, we should sleep a second to ensure the update call can be processed
[   +5 ms] I/flutter (22928): UI Isolate Callback: [384f753e-2958-4526-9fbc-9d2b12641b9d, DownloadTaskStatus(3), 100]
[  +10 ms] D/MediaScannerConnection(22928): Scanned /storage/emulated/0/Download/Android-Programming-Cookbook.pdf to content://media/external_primary/file/319376
[        ] D/DownloadWorker(22928): MediaStore updated (content://media/external_primary/file/319376)
[ +985 ms] D/DownloadWorker(22928): Update notification: {notificationId: 5, title: Android-Programming-Cookbook.pdf, status: 3, progress: 100}
[   +8 ms] D/DownloadWorker(22928): File downloaded
[   +5 ms] I/WM-WorkerWrapper(22928): Worker result SUCCESS for Work [ id=384f753e-2958-4526-9fbc-9d2b12641b9d, tags={ flutter_download_task, vn.hunghd.flutterdownloader.DownloadWorker } ]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
tijanirfcommented, Sep 13, 2021

Actually, we tried first on flutter 2.5 & flutter_downloader v1.7.0 and the error happened. Then we tried downgrading as I mentioned above in my comment. We end up rollback our app to flutter 2.2.1 and flutter_downloader v1.6.0 to make it works.

I’ll try to debug deeper and let you know about my findings on monday 🤞

There’s change on android storage management from Android 11. please upgrade to v1.7.0

I just tested on these specs and still got the same issue as mentioned above:

  • android version: 9
  • flutter_downloader: 1.7.0
  • flutter version: 2.5.0
Logs
D/DownloadWorker( 5067): DownloadWorker{url=https://storage.googleapis.com/vx_dev_tasks/tasks/710/INV2021015974 (1).pdf,filename=null,savedDir=/storage/emulated/0/Android/data/com.sunterra.vx.dev/files/Downloads,header=,isResume=false
D/DownloadWorker( 5067): Open connection to https://storage.googleapis.com/vx_dev_tasks/tasks/710/INV2021015974 (1).pdf
D/DownloadWorker( 5067): Content-Type = application/pdf
D/DownloadWorker( 5067): Content-Length = 85763
D/DownloadWorker( 5067): Charset = null
D/DownloadWorker( 5067): Content-Disposition = null
D/DownloadWorker( 5067): fileName = INV2021015974 (1).pdf
D/DownloadWorker( 5067): File downloaded (/storage/emulated/0/Download/INV2021015974 (1).pdf)
D/DownloadWorker( 5067): File downloaded
I/WM-WorkerWrapper( 5067): Worker result SUCCESS for Work [ id=e40f444b-ab20-49b9-b58d-12b77fe94c57, tags={ flutter_download_task, vn.hunghd.flutterdownloader.DownloadWorker } ]
D/DownloadWorker( 5067): MediaStore updated (content://media/external/file/696232)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (0)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (2)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (8)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (14)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (21)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (27)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (34)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (41)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (47)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (54)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (60)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (66)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (73)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (79)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (86)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (92)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (98)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(2)) and process (100)
I/flutter ( 5067): Background Isolate Callback: task (e40f444b-ab20-49b9-b58d-12b77fe94c57) is in status (DownloadTaskStatus(3)) and process (100)

Even though it’s written DownloadWorker{url=https://storage.googleapis.com/vx_dev_tasks/tasks/710/INV2021015974 (1).pdf,filename=null,savedDir=/storage/emulated/0/Android/data/com.sunterra.vx.dev/files/Downloads,header=,isResume=false, the file is not exist on the savedDir. The file is downloaded to /storage/emulated/0/Download/INV2021015974 (1).pdf

I’m not using android 11, so upgrading to v1.7.0 won’t fix the problem.

2reactions
tijanirfcommented, Sep 10, 2021

Also happened to me on:

  • android version: 9
  • flutter_downloader: 1.6.0
  • flutter version: 2.5.0

But, it was previously successful:

  • android version: 9
  • flutter_downloader: 1.6.0
  • flutter version: 2.2.1

Maybe the culprit is flutter 2.5.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

CD (SaveDir) doesn't work in Windows 7? - Microsoft - Tek-Tips
I finally broke down and installed VFP on my Win7 machine. Cruising along fine, and then this completely unexpected error happens: This ...
Read more >
r/cemu - Savedir does not appear in the program title bar, can't ...
Right-click the game in Cemus game list within Cemu and open the Save Directory option.
Read more >
Top 10 Reason your Server is not working and how to fix
After helping over 600 people setup there servers, here is the top 10 reasons their servers did not work.
Read more >
Save didn't work. now i can't recover my document
i copied the file to a different map. when I then reopened the file i had lost almost everything, it was a very...
Read more >
phpMyAdmin "The directory you set for upload work cannot be ...
php file already contains these lines: /* * Directories for saving/loading files from server */ $cfg['UploadDir'] = ''; $cfg['SaveDir'] = '';.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found