fluttercommunity / fluttercommunity/flutter_downloader

IllegalArgumentException from ItentUtils.buildIntent in downloadFile method

Open
#920 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Kotlin
Stars
940
Forks
561
Avg merge
1h 18m
Merged PRs (30d)
1

Description

The getApplicationDocumentsDirectory method is returning a path formatted as `**/data/user/0**/com.example.app/app_flutter`, which is causing a failure in a plugin that expects a path in the format of `**/data/data/**com.example.app/app_flutter`.

I created `Download` directory under `/data/user/0**/com.example.app/app_flutter`

D/DownloadWorker(10806): Update notification: {notificationId: 22, title: image.jpg, status: FAILED, progress: -1}
W/System.err(10806): java.lang.IllegalArgumentException: Failed to find configured root that contains **/data/data/com.example.app/app_flutter/Download/image.jpg**
W/System.err(10806): at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:825)
W/System.err(10806): at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:450)
W/System.err(10806): at vn.hunghd.flutterdownloader.IntentUtils.buildIntent(IntentUtils.kt:19)
W/System.err(10806): at vn.hunghd.flutterdownloader.IntentUtils.validatedFileIntent(IntentUtils.kt:36)
W/System.err(10806): at vn.hunghd.flutterdownloader.DownloadWorker.downloadFile(DownloadWorker.kt:446)
W/System.err(10806): at vn.hunghd.flutterdownloader.DownloadWorker.doWork(DownloadWorker.kt:206)
W/System.err(10806): at androidx.work.Worker$1.run(Worker.java:86)
W/System.err(10806): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
W/System.err(10806): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
W/System.err(10806): at java.lang.Thread.run(Thread.java:1012)

** UPDATE **
I learned that '/data/user/0' is a symlink to '/data/data' directory. Changed the bug title to "IllegalArgumentException from ItentUtils.buildIntent in downloadFile method."

**Expected behavior**

Downloads must be completed successfully, and files should be correctly saved in the `**/data/user/0**/com.example.app/app_flutter/Download` directory without any errors.

**Device information:**

- Device: Emulator (Pixel 7 Pro API 33)
- OS: Android 13
- plugin version 1.11.5

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with IntentUtils.kt:19 and validatedFileIntent at line 36, then trace the path passed from DownloadWorker.kt:446. Compare the /data/user/0 and /data/data paths used by FileProvider on Android 13; done means downloads complete and files are saved in the expected Download directory without IllegalArgumentException.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, flutter, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.