ko2ic / image_downloader

Flutter plugin that downloads images and movies on the Internet and saves to Photo Library on iOS or specified directory on Android.
https://pub.dartlang.org/packages/image_downloader#-readme-tab-
MIT License
92 stars 115 forks source link

Error receiving broadcast Intent #91

Open amaljoe opened 3 years ago

amaljoe commented 3 years ago

I am receiving the following error when trying to download an image from the backend using image downloader. It was working fine until compile sdk and target sdk was set to 28. But the app crashes after compile and target sdk was changed to 29.

E/AndroidRuntime(20499): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.DOWNLOAD_COMPLETE flg=0x10 pkg=com.leimo.leimo (has extras) } in com.ko2ic.imagedownloader.Downloader$execute$1@89e4369 E/AndroidRuntime(20499): at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1575) E/AndroidRuntime(20499): at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2) E/AndroidRuntime(20499): at android.os.Handler.handleCallback(Handler.java:883) E/AndroidRuntime(20499): at android.os.Handler.dispatchMessage(Handler.java:100) E/AndroidRuntime(20499): at android.os.Looper.loop(Looper.java:214) E/AndroidRuntime(20499): at android.app.ActivityThread.main(ActivityThread.java:7710) E/AndroidRuntime(20499): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(20499): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516) E/AndroidRuntime(20499): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) E/AndroidRuntime(20499): Caused by: java.io.FileNotFoundException: /storage/emulated/0/Download/2020-10-26.22.23.032: open failed: EACCES (Permission denied) E/AndroidRuntime(20499): at libcore.io.IoBridge.open(IoBridge.java:496) E/AndroidRuntime(20499): at java.io.FileInputStream.(FileInputStream.java:159) E/AndroidRuntime(20499): at com.ko2ic.imagedownloader.ImageDownloaderPlugin$CallbackImpl$granted$3.invoke(ImageDownloaderPlugin.kt:281) E/AndroidRuntime(20499): at com.ko2ic.imagedownloader.ImageDownloaderPlugin$CallbackImpl$granted$3.invoke(ImageDownloaderPlugin.kt:200) E/AndroidRuntime(20499): at com.ko2ic.imagedownloader.Downloader.resolveDownloadStatus(Downloader.kt:171) E/AndroidRuntime(20499): at com.ko2ic.imagedownloader.Downloader.access$resolveDownloadStatus(Downloader.kt:14) E/AndroidRuntime(20499): at com.ko2ic.imagedownloader.Downloader$execute$1.onReceive(Downloader.kt:33) E/AndroidRuntime(20499): at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1560) E/AndroidRuntime(20499): ... 8 more E/AndroidRuntime(20499): Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied) E/AndroidRuntime(20499): at libcore.io.Linux.open(Native Method) E/AndroidRuntime(20499): at libcore.io.ForwardingOs.open(ForwardingOs.java:167) E/AndroidRuntime(20499): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252) E/AndroidRuntime(20499): at libcore.io.ForwardingOs.open(ForwardingOs.java:167) E/AndroidRuntime(20499): at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7609) E/AndroidRuntime(20499): at libcore.io.IoBridge.open(IoBridge.java:482) E/AndroidRuntime(20499): ... 15 more W/System (20499): A resource failed to call close. I/Process (20499): Sending signal. PID: 20499 SIG: 9

evolvingkid commented 3 years ago

i also have same isses

m-schmailzl commented 3 years ago

I have the same problem. The error occurs only on Android 10 when trying to save an image outside of the ExternalFilesDir. I tested it with various phones and emulators.

Stewioie commented 3 years ago

For android 10 You can use android:requestLegacyExternalStorage="true" But if your app target is Android 11 this flag is not working anymore. Need to update this library for scoping storage

https://developer.android.com/training/data-storage#scoped-storage

darshitArkay commented 3 years ago

@Stewioie after adding android:requestLegacyExternalStorage="true" in manifest, the app is still crashing.

nonetrix commented 3 years ago

This seems to happen when I spam the download button in my app for some reason

vinicius-gregorio commented 2 years ago

This still happenning to me. Xiaomi MI 9 SE. Any workarounds?

shrijanRegmi commented 2 years ago

Nearly after 1year 6months the issue is unsolved

jacopofranza commented 2 years ago

Same problem

SergeiLebedevJobAdder commented 1 year ago

same problem on some divices it is working on some it is not. I found that problem was with that i added a ".pdf" file extension at the end of the file name. And then the problem has gone. So I tried to change to ".txt" even file is pdf that still worked. So I am not sure why is that.