要复制此问题,
以下是日志:
02-18 10:34:04.366 20142 20783 D progressxxx: 40
02-18 10:34:04.366 20142 20783 D xxx1111 : Download in progress!
02-18 10:34:04.368 2579 20883 W DownloadManager: [211] Stop requested
with status CANNOT_RESUME: Expected partial, but received OK
02-18 10:34:04.368 2579 20883 D DownloadManager: [211] Finished with
status CANNOT_RESUME
02-18 10:34:04.369 20142 20783 D progressxxx: 40
02-18 10:34:04.369 20142 20783 D xxx1111 : Download in progress!
02-18 10:34:04.373 20142 20783 D progressxxx: 40
02-18 10:34:04.373 20142 20783 D xxx1111 : Download in progress!
02-18 10:34:04.376 2579 20883 V DownloadManager: MIME Type =
application/vnd.android.package-archive
02-18 10:34:04.380 20142 20783 D progressxxx: 40
02-18 10:34:04.380 20142 20783 D xxx1111 : Download failed!
02-18 10:34:04.381 4875 5061 D JobServiceContext:
sendStopMessageLocked stop reason: cancel() called by app,
callingUid=10052 uid=10052 jobId=211
02-18 10:34:04.382 2579 20883 D DownloadManager: Send intent: mId:211
status:489 mTitle:Download
02-18 10:34:04.385 2579 20883 I DownloadManager: Download 211
finished with status CANNOT_RESUME
--------- beginning of crash
02-18 10:34:04.386 20142 20783 E AndroidRuntime: FATAL EXCEPTION:
Thread-11
02-18 10:34:04.386 20142 20783 E AndroidRuntime: Process:
com.example.sensen.gemineyedownloadmanager, PID: 20142
02-18 10:34:04.386 20142 20783 E AndroidRuntime:
java.lang.ArithmeticException: divide by zero
02-18 10:34:04.386 20142 20783 E AndroidRuntime: at
答案 0 :(得分:0)
由于我使用过Android Download Manager,因此很难保持暂停或继续并重新开始下载。如果要使用Android下载管理器使用此功能,则必须编写更多代码。您将必须维护文件路径等。
如果要使用其他下载库轻松实现它,则其中一个库为fetch,可以轻松实现和维护这些功能。