okdownload
okdownload copied to clipboard
cause:ERROR realCause:com.liulishuo.okdownload.core.exception.ServerCanceledException
OkDownload Version
v1.0.7
Problem Describe
url = "https://wwwd.bus365.cn/public/phoneClient/BUS365.apk"; first:downloadTask.enqueue; second: after a few seconds call the task.cancel(); The third step: when build the same task to enqueue, called the "taskEnd" with "com.liulishuo.okdownload.core.exception.ServerCanceledException";
1.先调用下载,几秒钟后调用cancel进行终止;之后再用同样的url去build相同的task,执行下载,直接回调taskend报错。 cause:ERROR realCause:com.liulishuo.okdownload.core.exception.ServerCanceledException: Response code can't handled on internal 200 with current offset 2801340
Log
09-10 15:23:25.420 32131-32131/cn.nova.phone E/DownloadTask: cause:CANCELED realCause:null 09-10 15:23:35.206 32131-32131/cn.nova.phone E/DownloadTask: cause:ERROR realCause:com.liulishuo.okdownload.core.exception.ServerCanceledException: Response code can't handled on internal 200 with current offset 2801340
final String apkUrl = "https://wwwd.bus365.cn/public/phoneClient/BUS365.apk";
String sdpath = Util.getDiskCacheDir(getApplicationContext());
String name = getString(R.string.app_name) + ".apk";
// String path = sdpath + "/" + name;
//下载
DownloadTask.Builder builder = new DownloadTask.Builder(apkUrl, sdpath, name)
// the minimal interval millisecond for callback progress
.setMinIntervalMillisCallbackProcess(200)
//Set whether need to pre allocate length for the file after get the resource-length from trial-connection.
.setPreAllocateLength(true)
// do re-download even if the task has already been completed in the past.
.setPassIfAlreadyCompleted(false);
builder.addHeader("Accept-Encoding", "*");
downloadTask = builder.build();
downloadTask.enqueue(new DownloadListener4WithSpeed(){});
杀死app进程后,再重新进入,执行同样的下载,则不会出现报错。