question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.getPath()' on a null object reference

See original GitHub issue

This is the consol message when I tried to download task


Backoff delay duration less than minimum value
I/flutter (22485): f774957b-612b-4aac-857a-8c817e3f8e33
D/EGL_emulation(22485): eglCreateContext: 0xf4066ff0: maj 2 min 0 rcv 2
D/EGL_emulation(22485): eglCreateContext: 0xf4066960: maj 2 min 0 rcv 2
D/HostConnection(22485): HostConnection::get() New Host Connection established 0xf4068090, tid 22562
D/HostConnection(22485): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_2
D/EGL_emulation(22485): eglMakeCurrent: 0xf4066960: ver 2 0 (tinfo 0xb32a4450) (first time)
D/PathProviderPlugin(22485): Use TaskQueues.
D/DownloadWorker(22485): DownloadWorker{url=[https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf,filename=null,savedDir=/storage/emulated/0/Download,header=,isResume=false,status=1]()
D/DownloadWorker(22485): Update notification: {notificationId: 5, title: [https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf](), status: 2, progress: 0}
D/DownloadWorker(22485): Open connection to [https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf]()
D/DownloadWorker(22485): Content-Type = application/pdf
D/DownloadWorker(22485): Content-Length = 4186004
D/DownloadWorker(22485):  Charset = null
D/DownloadWorker(22485): Content-Disposition = null
D/DownloadWorker(22485): fileName = flutter-succinctly.pdf
E/DownloadWorker(22485): It looks like you are trying to save file in public storage but not setting 'saveInPublicStorage' to 'true'
D/DownloadWorker(22485): Update notification: {notificationId: 5, title: [https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf](), status: 4, progress: -1}
W/System.err(22485): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.getPath()' on a null object reference
W/System.err(22485): 	at vn.hunghd.flutterdownloader.DownloadWorker.downloadFile(DownloadWorker.java:398)
W/System.err(22485): 	at vn.hunghd.flutterdownloader.DownloadWorker.doWork(DownloadWorker.java:235)
W/System.err(22485): 	at androidx.work.Worker$1.run(Worker.java:86)
W/System.err(22485): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err(22485): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err(22485): 	at java.lang.Thread.run(Thread.java:923)
I/WM-WorkerWrapper(22485): Worker result FAILURE for Work [ id=f774957b-612b-4aac-857a-8c817e3f8e33, tags={ flutter_download_task, vn.hunghd.flutterdownloader.DownloadWorker } ]
I/flutter (22485): Fatal: could not find callback
D/HostConnection(22485): HostConnection::get() New Host Connection established 0xf406b4a0, tid 22560
F/libc    (22485): FORTIFY: pthread_mutex_lock called on a destroyed mutex (0xc4931d28)
F/libc    (22485): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 22516 (1.ui), pid 22485 (ample.task_flow)
Lost connection to device.


Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
selvas1998commented, Mar 4, 2022

It looks like you are trying to save files in public storage but not setting ‘saveInPublicStorage’ to ‘true’. Set saveInPublicStorage as true in flutterDownloader.

Example: FlutterDownloader.enqueue( url: ‘YOUR_URL’, savedDir: ‘YOUR_PATH’, saveInPublicStorage: true, showNotification: true);

5reactions
xuelongqycommented, Mar 21, 2022

This problem occurs when the file already exists

Read more comments on GitHub >

github_iconTop Results From Across the Web

Attempt to invoke virtual method 'java.lang.String java.io.File ...
NullPointerException : Attempt to invoke virtual method 'java.lang.String java.io.File.getName()' on a null object reference.
Read more >
attempt to invoke virtual method on a null object reference
Java.lang.nullpointerexception: attempt to invoke virtual method on a null object reference ; private var ; private var ; var resourceId = 0 ;...
Read more >
Error: java.lang.NullPointerException: Attempt to invoke virtual ...
I refer to DemoActivity.java and use the RunMethod method to test in B4A. There is no problem in calling the "init" method, but...
Read more >
"Attempt to invoke virtual method 'java.lang.String android ...
"Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference" when authenticting ...
Read more >
Fixed Error android error attempt to invoke virtual method
... attempt to invoke virtual method and resolved java. lang. NullPointerException : Attempt to invoke virtual method. Many error code cames in ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found