fluttercommunity / flutter_downloader

Flutter Downloader - A plugin for creating and managing download tasks.
https://pub.dev/packages/flutter_downloader
BSD 3-Clause "New" or "Revised" License
911 stars 511 forks source link

NullPointerException Preconditions.checkNotNull #604

Open lakshyapunhani opened 2 years ago

lakshyapunhani commented 2 years ago

Trying to download an apk but facing null pointer exception but downloading all other files(pdf, jpg,mp4) is working perfectly.

Device details Redmi 9 power MIUI version - MIUI Global 12.0.8 Android version 10

D/DownloadWorker(11812): DownloadWorker{url=https://********/getapp,filename=null,savedDir=/storage/emulated/0/Download,header={"auth": "test_for_sql_encoding"},isResume=false,status=1 D/DownloadWorker(11812): Update notification: {notificationId: 1, title: https://*********/getapp, status: 2, progress: 0} D/DownloadWorker(11812): Open connection to https://testapi.*******/getapp D/DownloadWorker(11812): Headers = {"auth": "test_for_sql_encoding"} D/DownloadWorker(11812): Content-Type = application/vnd.android.package-archive D/DownloadWorker(11812): Content-Length = 33078327 D/DownloadWorker(11812): Charset = null D/DownloadWorker(11812): Content-Disposition = attachment; filename="TradexAnroid12.apk" D/DownloadWorker(11812): fileName = TradexAnroid12.apk D/DownloadWorker(11812): Update too frequently!!!!, but it is the final update, we should sleep a second to ensure the update call can be processed I/flutter (11812): Background Isolate Callback: task (4598890d-7f1f-4ce6-b34e-4b6718753358) is in status (DownloadTaskStatus(2)) and process (0) I/flutter (11812): UI Isolate Callback: [4598890d-7f1f-4ce6-b34e-4b6718753358, DownloadTaskStatus(2), 0] I/flutter (11812): Background Isolate Callback: task (4598890d-7f1f-4ce6-b34e-4b6718753358) is in status (DownloadTaskStatus(4)) and process (-1) I/flutter (11812): UI Isolate Callback: [4598890d-7f1f-4ce6-b34e-4b6718753358, DownloadTaskStatus(4), -1] D/DownloadWorker(11812): Update notification: {notificationId: 1, title: https://testapi.*******/getapp, status: 4, progress: -1} W/System.err(11812): java.lang.NullPointerException: uri W/System.err(11812): at com.android.internal.util.Preconditions.checkNotNull(Preconditions.java:133) W/System.err(11812): at android.content.ContentResolver.query(ContentResolver.java:920) W/System.err(11812): at android.content.ContentResolver.query(ContentResolver.java:881) W/System.err(11812): at android.content.ContentResolver.query(ContentResolver.java:837) W/System.err(11812): at vn.hunghd.flutterdownloader.DownloadWorker.getMediaStoreEntryPathApi29(DownloadWorker.java:534) W/System.err(11812): at vn.hunghd.flutterdownloader.DownloadWorker.downloadFile(DownloadWorker.java:397) W/System.err(11812): at vn.hunghd.flutterdownloader.DownloadWorker.doWork(DownloadWorker.java:235) W/System.err(11812): at androidx.work.Worker$1.run(Worker.java:86) W/System.err(11812): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) W/System.err(11812): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) W/System.err(11812): at java.lang.Thread.run(Thread.java:919) I/WM-WorkerWrapper(11812): Worker result FAILURE for Work [ id=4598890d-7f1f-4ce6-b34e-4b6718753358, tags={ flutter_download_task, vn.hunghd.flutterdownloader.DownloadWorker } ]

Teenbenja commented 2 years ago

Facing this issue as well with saveInPublicStorage enabled, only on an older model of our testing phone.

sh4msi commented 2 years ago

Facing this issue as well with saveInPublicStorage enabled, only on an older model of our testing phone.

solution ?