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

Issue while Opening the file #967

Open
Ashwin1002 opened this issue Jul 23, 2024 · 2 comments
Open

Issue while Opening the file #967

Ashwin1002 opened this issue Jul 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Ashwin1002
Copy link

When Opening the file throws error.
java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.example.example/cache/SubaruOutbackOnStreetAndDirt.mp4

The, directory where the file exist is only "data/com.example.example/cache/SubaruOutbackOnStreetAndDirt.mp4" but when opening the file it prints extra "data" in the path

*To Reproduce

await FlutterDownloader.open(taskId: taskID)

Steps to reproduce the behavior:

  1. Use FlutterDownloader.open(taskId: '$String') method

Expected behavior
Should open the existed file, but throws exception.

Log

The full log is :

E/MethodChannel#vn.hunghd/downloader( 4630): Failed to handle method call
E/MethodChannel#vn.hunghd/downloader( 4630): java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.example.example/cache/SubaruOutbackOnStreetAndDirt.mp4
E/MethodChannel#vn.hunghd/downloader( 4630): at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:825)
E/MethodChannel#vn.hunghd/downloader( 4630): at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:450)
E/MethodChannel#vn.hunghd/downloader( 4630): at vn.hunghd.flutterdownloader.IntentUtils.buildIntent(IntentUtils.kt:19)
E/MethodChannel#vn.hunghd/downloader( 4630): at vn.hunghd.flutterdownloader.IntentUtils.validatedFileIntent(IntentUtils.kt:36)
E/MethodChannel#vn.hunghd/downloader( 4630): at vn.hunghd.flutterdownloader.FlutterDownloaderPlugin.open(FlutterDownloaderPlugin.kt:369)
E/MethodChannel#vn.hunghd/downloader( 4630): at vn.hunghd.flutterdownloader.FlutterDownloaderPlugin.onMethodCall(FlutterDownloaderPlugin.kt:66)
E/MethodChannel#vn.hunghd/downloader( 4630): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/MethodChannel#vn.hunghd/downloader( 4630): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/MethodChannel#vn.hunghd/downloader( 4630): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#vn.hunghd/downloader( 4630): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#vn.hunghd/downloader( 4630): at android.os.Handler.handleCallback(Handler.java:959)
E/MethodChannel#vn.hunghd/downloader( 4630): at android.os.Handler.dispatchMessage(Handler.java:100)
E/MethodChannel#vn.hunghd/downloader( 4630): at android.os.Looper.loopOnce(Looper.java:232)
E/MethodChannel#vn.hunghd/downloader( 4630): at android.os.Looper.loop(Looper.java:317)
E/MethodChannel#vn.hunghd/downloader( 4630): at android.app.ActivityThread.main(ActivityThread.java:8674)
E/MethodChannel#vn.hunghd/downloader( 4630): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#vn.hunghd/downloader( 4630): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
E/MethodChannel#vn.hunghd/downloader( 4630): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
I/flutter ( 4630): Failed to open downloaded file. Reason: Failed to find configured root that contains /data/data/com.example.example/cache/SubaruOutbackOnStreetAndDirt.mp4

@Ashwin1002 Ashwin1002 added the bug Something isn't working label Jul 23, 2024
@nafiskabbo
Copy link

nafiskabbo commented Jul 28, 2024

I have the same issue. Any solution?

@Ashwin1002
Copy link
Author

For current fix, I am using open_filex package. To get the file path, i have saved the absolute path of the directory and get the file name from the url and used it to open the file only on Android.

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

2 participants