Open mohammed7aafar opened 4 years ago
Thanks for the report.
Currently, I am busy and have not been able to maintain this Plugin.
I will watch it when I have time, so please wait.
I found a temporary fix here. Just add the following to your AndroidManifest.xml
<application android:requestLegacyExternalStorage="true" ... >
<application android:requestLegacyExternalStorage="true" ... >
This halfy works for me. Image sometimes downloaded sometimes not. But in all cases downloaded file cannot be opened via
var path = await ImageDownloader.findPath(imageId);
if (path != null) {
await ImageDownloader.open(path);
}
Same. The stacktrace I'm getting is
D/image_downloader(14692): RequestResult(id=4866, remoteUri=https://preview.redd.it/ox231rheg4l41.jpg?auto=webp&s=4422cb90dcea106a04bbf75fbb7a2bb1b9fdc71b, localUri=file:///storage/emulated/0/Download/2020-03-06.18.29.058, mediaType=image/jpeg, totalSize=274100, title=2020-03-06.18.29.058, description=)
D/AndroidRuntime(14692): Shutting down VM
E/AndroidRuntime(14692): FATAL EXCEPTION: main
E/AndroidRuntime(14692): Process: tushyboi.com.flutter_provider_app, PID: 14692
E/AndroidRuntime(14692): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.DOWNLOAD_COMPLETE flg=0x10 pkg=tushyboi.com.flutter_provider_app (has extras) } in com.ko2ic.imagedownloader.Downloader$execute$1@9c24cef
E/AndroidRuntime(14692): at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1656)
E/AndroidRuntime(14692): at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
E/AndroidRuntime(14692): at android.os.Handler.handleCallback(Handler.java:883)
E/AndroidRuntime(14692): at android.os.Handler.dispatchMessage(Handler.java:100)
E/AndroidRuntime(14692): at android.os.Looper.loop(Looper.java:237)
E/AndroidRuntime(14692): at android.app.ActivityThread.main(ActivityThread.java:7770)
E/AndroidRuntime(14692): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(14692): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/AndroidRuntime(14692): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)
E/AndroidRuntime(14692): Caused by: java.io.FileNotFoundException: /storage/emulated/0/Download/2020-03-06.18.29.058: open failed: EACCES (Permission denied)
E/AndroidRuntime(14692): at libcore.io.IoBridge.open(IoBridge.java:496)
E/AndroidRuntime(14692): at java.io.FileInputStream.<init>(FileInputStream.java:159)
E/AndroidRuntime(14692): at com.ko2ic.imagedownloader.ImageDownloaderPlugin$CallbackImpl$granted$3.invoke(ImageDownloaderPlugin.kt:280)
E/AndroidRuntime(14692): at com.ko2ic.imagedownloader.ImageDownloaderPlugin$CallbackImpl$granted$3.invoke(ImageDownloaderPlugin.kt:200)
E/AndroidRuntime(14692): at com.ko2ic.imagedownloader.Downloader.resolveDownloadStatus(Downloader.kt:171)
E/AndroidRuntime(14692): at com.ko2ic.imagedownloader.Downloader.access$resolveDownloadStatus(Downloader.kt:14)
E/AndroidRuntime(14692): at com.ko2ic.imagedownloader.Downloader$execute$1.onReceive(Downloader.kt:33)
E/AndroidRuntime(14692): at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1646)
E/AndroidRuntime(14692): ... 8 more
E/AndroidRuntime(14692): Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
E/AndroidRuntime(14692): at libcore.io.Linux.open(Native Method)
E/AndroidRuntime(14692): at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
E/AndroidRuntime(14692): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
E/AndroidRuntime(14692): at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
E/AndroidRuntime(14692): at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7644)
E/AndroidRuntime(14692): at libcore.io.IoBridge.open(IoBridge.java:482)
E/AndroidRuntime(14692): ... 15 more
I/Process (14692): Sending signal. PID: 14692 SIG: 9
Edit: Solved issue by adding https://github.com/ko2ic/image_downloader/blob/7f8a43e5ec5899cbe3034de8871011d7849a18f1/example/android/app/src/main/AndroidManifest.xml#L14 this to my android manifest
Same for #84
in ios it works fine but in some android versions it does either crashes the app or it doesn't download the image.