Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException from ItentUtils.buildIntent in downloadFile method #920

Open
claptv opened this issue Nov 29, 2023 · 3 comments
Open
Labels
bug Something isn't working

Comments

@claptv
Copy link

claptv commented Nov 29, 2023

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
@claptv claptv added the bug Something isn't working label Nov 29, 2023
@claptv claptv changed the title Path Mismatch in getApplicationDocumentsDirectory Usage on Android 13 IllegalArgumentException from ItentUtils.buildIntent in downloadFile method Nov 30, 2023
@vzhilong
Copy link

I facing the same bug here.

@claptv
Copy link
Author

claptv commented Dec 3, 2023

Same problem with a temporary directory.

Update notification: {notificationId: 66, title: 20231129_040121_696.jpg, status: FAILED, progress: -1}
W/System.err(17793): java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.example.app/cache/image.jpg

@yogendra-algoworks
Copy link

yogendra-algoworks commented May 20, 2024

Below soln resolve issue.

You have to add xml/provider_paths.xml in android res folder

Screenshot 2024-05-20 at 3 23 47 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants