0

When to try to download PDF file (from our host), it start download, and the notification start to appear, but finally it fail to download.

Here the log report show the error

D/ColorViewRootUtil( 8717): nav bar mode ignore false downX 581 downY 1184
D/ColorViewRootUtil( 8717): nav bar mode ignore false downX 581 downY 1184 mScreenHeight 2280 mScreenWidth 1080 mStatusBarHeight 54 globalScale 1.125 nav mode 0 rotation 0 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=581.0, y[0]=1184.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=8621316, downTime=8621316, deviceId=1, source=0x1002, displayId=0 }
D/ViewRootImpl[Toast]( 8717): hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
I/InputTransport( 8717): Create ARC handle: 0x7282b4a2e0
D/Surface ( 8717): Surface::connect(this=0x718dc93000,api=1)
D/mali_winsys( 8717): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/Surface ( 8717): Surface::setBufferCount(this=0x718dc93000,bufferCount=3)
D/Surface ( 8717): Surface::allocateBuffers(this=0x718dc93000)
D/DownloadWorker( 8717): DownloadWorker{url=https://connect-elearning.com/newVersion/uploads/lesson_files/d19dbae4957c042e2e790522802a0abe.pdf,filename=null,savedDir=/sdcard/download/,header={},isResume=false,status=ENQUEUED
D/DownloadWorker( 8717): Update notification: {notificationId: 12, title: https://connect-elearning.com/newVersion/uploads/lesson_files/d19dbae4957c042e2e790522802a0abe.pdf, status: RUNNING, progress: 0}
D/DownloadWorker( 8717): Open connection to https://connect-elearning.com/newVersion/uploads/lesson_files/d19dbae4957c042e2e790522802a0abe.pdf
D/DownloadWorker( 8717): Headers = {}
D/DownloadWorker( 8717): Content-Type = application/pdf
D/DownloadWorker( 8717): Content-Length = 138650
D/DownloadWorker( 8717): Charset = null
D/DownloadWorker( 8717): Content-Disposition = null
D/DownloadWorker( 8717): fileName = d19dbae4957c042e2e790522802a0abe.pdf
E/DownloadWorker( 8717): It looks like you are trying to save file in public storage but not setting 'saveInPublicStorage' to 'true'
D/DownloadWorker( 8717): Update too frequently!!!!, but it is the final update, we should sleep a second to ensure the update call can be processed
D/DownloadWorker( 8717): Update notification: {notificationId: 12, title: https://connect-elearning.com/newVersion/uploads/lesson_files/d19dbae4957c042e2e790522802a0abe.pdf, status: FAILED, progress: -1}
W/System.err( 8717): java.lang.NullPointerException
W/System.err( 8717):    at vn.hunghd.flutterdownloader.DownloadWorker.downloadFile(DownloadWorker.kt:393)
W/System.err( 8717):    at vn.hunghd.flutterdownloader.DownloadWorker.doWork(DownloadWorker.kt:206)
W/System.err( 8717):    at androidx.work.Worker$1.run(Worker.java:86)
W/System.err( 8717):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err( 8717):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err( 8717):    at java.lang.Thread.run(Thread.java:919)
I/WM-WorkerWrapper( 8717): Worker result FAILURE for Work [ id=52f3d981-1c8c-4174-afe1-132b4a6f1134, tags={ flutter_download_task, vn.hunghd.flutterdownloader.DownloadWorker } ]
D/Surface ( 8717): Surface::disconnect(this=0x718dc93000,api=1)
D/View    ( 8717): [Warning] assignParent to null: this = android.widget.FrameLayout{69c7301 V.E...... ......ID 0,0-376,125}
I/InputTransport( 8717): Destroy ARC handle: 0x7282b4a2e0D/ColorViewRootUtil( 8717): nav bar mode ignore false downX 581 downY 1184 mScreenHeight 2280 mScreenWidth 1080 mStatusBarHeight 54 globalScale 1.125 nav mode 0 rotation 0 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=581.0, y[0]=1184.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=8621316, downTime=8621316, deviceId=1, source=0x1002, displayId=0 }
D/ViewRootImpl[Toast]( 8717): hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
I/InputTransport( 8717): Create ARC handle: 0x7282b4a2e0
D/Surface ( 8717): Surface::connect(this=0x718dc93000,api=1)
D/mali_winsys( 8717): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/Surface ( 8717): Surface::setBufferCount(this=0x718dc93000,bufferCount=3)
D/Surface ( 8717): Surface::allocateBuffers(this=0x718dc93000)
D/DownloadWorker( 8717): DownloadWorker{url=https://connect-elearning.com/newVersion/uploads/lesson_files/d19dbae4957c042e2e790522802a0abe.pdf,filename=null,savedDir=/sdcard/download/,header={},isResume=false,status=ENQUEUED
D/DownloadWorker( 8717): Update notification: {notificationId: 12, title: https://connect-elearning.com/newVersion/uploads/lesson_files/d19dbae4957c042e2e790522802a0abe.pdf, status: RUNNING, progress: 0}
D/DownloadWorker( 8717): Open connection to https://connect-elearning.com/newVersion/uploads/lesson_files/d19dbae4957c042e2e790522802a0abe.pdf
D/DownloadWorker( 8717): Headers = {}
D/DownloadWorker( 8717): Content-Type = application/pdf
D/DownloadWorker( 8717): Content-Length = 138650
D/DownloadWorker( 8717): Charset = null
D/DownloadWorker( 8717): Content-Disposition = null
D/DownloadWorker( 8717): fileName = d19dbae4957c042e2e790522802a0abe.pdf
E/DownloadWorker( 8717): It looks like you are trying to save file in public storage but not setting 'saveInPublicStorage' to 'true'
D/DownloadWorker( 8717): Update too frequently!!!!, but it is the final update, we should sleep a second to ensure the update call can be processed
D/DownloadWorker( 8717): Update notification: {notificationId: 12, title: https://connect-elearning.com/newVersion/uploads/lesson_files/d19dbae4957c042e2e790522802a0abe.pdf, status: FAILED, progress: -1}
W/System.err( 8717): java.lang.NullPointerException
W/System.err( 8717):    at vn.hunghd.flutterdownloader.DownloadWorker.downloadFile(DownloadWorker.kt:393)
W/System.err( 8717):    at vn.hunghd.flutterdownloader.DownloadWorker.doWork(DownloadWorker.kt:206)
W/System.err( 8717):    at androidx.work.Worker$1.run(Worker.java:86)
W/System.err( 8717):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err( 8717):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err( 8717):    at java.lang.Thread.run(Thread.java:919)
I/WM-WorkerWrapper( 8717): Worker result FAILURE for Work [ id=52f3d981-1c8c-4174-afe1-132b4a6f1134, tags={ flutter_download_task, vn.hunghd.flutterdownloader.DownloadWorker } ]
D/Surface ( 8717): Surface::disconnect(this=0x718dc93000,api=1)
D/View    ( 8717): [Warning] assignParent to null: this = android.widget.FrameLayout{69c7301 V.E...... ......ID 0,0-376,125}
I/InputTransport( 8717): Destroy ARC handle: 0x7282b4a2e0mScreenHeight 2280 mScreenWidth 1080 mStatusBarHeight 54 globalScale 1.125 nav mode 0 rotation 0 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=581.0, y[0]=1184.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=8621316, downTime=8621316, deviceId=1, source=0x1002, displayId=0 }
D/ViewRootImpl[Toast]( 8717): hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
I/InputTransport( 8717): Create ARC handle: 0x7282b4a2e0
D/Surface ( 8717): Surface::connect(this=0x718dc93000,api=1)
D/mali_winsys( 8717): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/Surface ( 8717): Surface::setBufferCount(this=0x718dc93000,bufferCount=3)
D/Surface ( 8717): Surface::allocateBuffers(this=0x718dc93000)
D/DownloadWorker( 8717): DownloadWorker{url=https://connect-elearning.com/newVersion/uploads/lesson_files/d19dbae4957c042e2e790522802a0abe.pdf,filename=null,savedDir=/sdcard/download/,header={},isResume=false,status=ENQUEUED
D/DownloadWorker( 8717): Update notification: {notificationId: 12, title: https://connect-elearning.com/newVersion/uploads/lesson_files/d19dbae4957c042e2e790522802a0abe.pdf, status: RUNNING, progress: 0}
D/DownloadWorker( 8717): Open connection to https://connect-elearning.com/newVersion/uploads/lesson_files/d19dbae4957c042e2e790522802a0abe.pdf
D/DownloadWorker( 8717): Headers = {}
D/DownloadWorker( 8717): Content-Type = application/pdf
D/DownloadWorker( 8717): Content-Length = 138650
D/DownloadWorker( 8717): Charset = null
D/DownloadWorker( 8717): Content-Disposition = null
D/DownloadWorker( 8717): fileName = d19dbae4957c042e2e790522802a0abe.pdf
E/DownloadWorker( 8717): It looks like you are trying to save file in public storage but not setting 'saveInPublicStorage' to 'true'
D/DownloadWorker( 8717): Update too frequently!!!!, but it is the final update, we should sleep a second to ensure the update call can be processed
D/DownloadWorker( 8717): Update notification: {notificationId: 12, title: https://connect-elearning.com/newVersion/uploads/lesson_files/d19dbae4957c042e2e790522802a0abe.pdf, status: FAILED, progress: -1}
W/System.err( 8717): java.lang.NullPointerException
W/System.err( 8717):    at vn.hunghd.flutterdownloader.DownloadWorker.downloadFile(DownloadWorker.kt:393)
W/System.err( 8717):    at vn.hunghd.flutterdownloader.DownloadWorker.doWork(DownloadWorker.kt:206)
W/System.err( 8717):    at androidx.work.Worker$1.run(Worker.java:86)
W/System.err( 8717):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err( 8717):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err( 8717):    at java.lang.Thread.run(Thread.java:919)
I/WM-WorkerWrapper( 8717): Worker result FAILURE for Work [ id=52f3d981-1c8c-4174-afe1-132b4a6f1134, tags={ flutter_download_task, vn.hunghd.flutterdownloader.DownloadWorker } ]
D/Surface ( 8717): Surface::disconnect(this=0x718dc93000,api=1)
D/View    ( 8717): [Warning] assignParent to null: this = android.widget.FrameLayout{69c7301 V.E...... ......ID 0,0-376,125}
I/InputTransport( 8717): Destroy ARC handle: 0x7282b4a2e0

And here part of DownloadWorker.kt file, that contain the error message shown in log error

It looks like you are trying to save file in public storage but not setting 'saveInPublicStorage' to 'true'

private fun createFileInAppSpecificDir(filename: String, savedDir: String): File? {
        val newFile = File(savedDir, filename)
        try {
            val rs: Boolean = newFile.createNewFile()
            if (rs) {
                return newFile
            } else {
                logError("It looks like you are trying to save file in public storage but not setting 'saveInPublicStorage' to 'true'")
            }
        } catch (e: IOException) {
            e.printStackTrace()
            logError("Create a file using java.io API failed ")
        }
        return null
    }
slackgate
  • 57
  • 2
  • 7
  • _This error is also happening on Android when the file is in the directory but I'm trying to download it using the downloader_ as mentioned https://github.com/fluttercommunity/flutter_downloader/issues/620 – OMi Shah Aug 21 '23 at 23:50
  • See [this](https://github.com/fluttercommunity/flutter_downloader/issues/611#issuecomment-1059124963) response. Seems you need to pass the option it is telling you to set, into the downloader. That, or the file you are trying to create has a bad path / name. Do all directories in the path leading to the file actually exist? – Matt Clark Aug 22 '23 at 00:15
  • @OMiShah Here, It happen on Android & iOS – slackgate Aug 22 '23 at 00:32

0 Answers0