lingochamp / filedownloader Goto Github PK
View Code? Open in Web Editor NEWMultitask、MultiThread(MultiConnection)、Breakpoint-resume、High-concurrency、Simple to use、Single/NotSingle-process
License: Apache License 2.0
Multitask、MultiThread(MultiConnection)、Breakpoint-resume、High-concurrency、Simple to use、Single/NotSingle-process
License: Apache License 2.0
通过gradle 导包失败,看看是不是传到maven的过程中出了什么问题,编译时下载了okhttp和okio,但是就是没有下载得到你的library包
Even though the filedownloader process is still alive, it stops download right after i kill my application (swipe to close app).
I'm developing a library that use FileDownloader as Download Engine. But I don't want to suppress creation of Application class. Because of that I prefer use Activities only. When I start FileDownloader with FileDownloader.init(getApplication()) in Activity then start a DownloadTask FileDownloader Service throw this error:
02-07 11:22:36.370 32492-32492/com.***.library:filedownloader E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.***.library:filedownloader, PID: 32492
java.lang.RuntimeException: Unable to create service com.liulishuo.filedownloader.services.FileDownloadService: java.lang.NullPointerException: Attempt to invoke virtual method 'android.database.sqlite.SQLiteDatabase android.content.Context.openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase$CursorFactory, android.database.DatabaseErrorHandler)' on a null object reference
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3684)
at android.app.ActivityThread.access$2000(ActivityThread.java:218)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1801)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6914)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.database.sqlite.SQLiteDatabase android.content.Context.openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase$CursorFactory, android.database.DatabaseErrorHandler)' on a null object reference
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
at com.liulishuo.filedownloader.services.FileDownloadDBHelper.<init>(FileDownloadDBHelper.java:49)
at com.liulishuo.filedownloader.services.FileDownloadMgr.<init>(FileDownloadMgr.java:47)
at com.liulishuo.filedownloader.services.FileDownloadService$FileDownloadServiceBinder.<init>(FileDownloadService.java:78)
at com.liulishuo.filedownloader.services.FileDownloadService$FileDownloadServiceBinder.<init>(FileDownloadService.java:72)
at com.liulishuo.filedownloader.services.FileDownloadService.createBinder(FileDownloadService.java:54)
at com.liulishuo.filedownloader.services.FileDownloadService.createBinder(FileDownloadService.java:33)
at com.liulishuo.filedownloader.services.BaseFileService.onCreate(BaseFileService.java:66)
at com.liulishuo.filedownloader.services.FileDownloadService.onCreate(FileDownloadService.java:39)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3674)
at android.app.ActivityThread.access$2000(ActivityThread.java:218)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1801)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6914)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
What should I do? What is the difference between FileDownloader.init(this) in Application and FileDownloader.init(getApplication()) in Activity?
In Android 5.0 and greater, if I try to download any file in external sd card, I get a IOException: access denied: "open failed: EACCES (Permission denied)". The download path is set to /storage/sdcard1/my_file.xml
error()-629675092, msg=fstat failed: ENOENT (No such file or directory)
how do set FileDownloader use myself okhttp instance
Hi, thinks for your project , and I have a question that can I custom my DefaultSaveRootPath?
修改Demo TasksManagerDemoActivity运行会发现只有url2能够断点下载,url1和Url3无法断点下载,暂停继续后从0开始
String url1 = "http://219.128.78.33/apk.r1.market.hiapk.com/data/upload/2015/05_20/14/com.speedsoftware.rootexplorer_140220.apk";
String url2 = "http://anzhuo.webdown.paojiao.cn/game/6cb/ab7/cb92a447231d2865d6536b1b32/com.wistone.war2victory_20150909103114_2.8.1_build_16302_wst.apk";
String url3 = "http://61.144.207.146:8081/11fe58ea-97e8-4452-bff6-59bdc0fcbde2/2001/7d/d8/7dd8739b-fc8e-43fe-9b76-6612838453a6/kfid/422201/ctrip.android.view_100429.apk";
private void initDemo() {
if (modelList.size() <= 0) {
// final int demoSize = 16;
// for (int i = 0; i < demoSize; i++) {
// final String url = Constant.URLS[i];
// addTask(url);
// }
addTask(url1);
addTask(url2);
addTask(url3);
modelList = dbController.getAllTasks();
}
}
```java
暂停下载以后如何恢复下载,默认不是断点续传,是重新下载
I want to know how could I use FileDownloader on a separate thread in a sync way. I've tried with setSyncCallback
but it didn't work for me.
Thanks!
对这个回调次数不是很理解,能简单说明一下吗.
Hi, firstly thank you for this great library.
I'm using Single Task mode, progress method is running perfectly with Wi-Fi but when i download with Cellular Network (3G) totalbytes always returns -1 also sometimes in Log it writes "unused values! by process callback" Can you help about this?
Best regards.
在下载中时断开网络连接,然后重新开始下载的时候又重头开始下了
I/CameraActivity: url=http://192.168.77.1:8000/sdcard/[email protected]
03-01 18:14:50.642 32464-32464/com.insta360.explore I/CameraActivity: flag=true
03-01 18:14:50.642 32464-32464/com.insta360.explore I/CameraActivity: Stack Size=1
03-01 18:14:50.922 32464-32464/com.insta360.explore I/CameraActivity: long pending()-903804433
03-01 18:14:50.922 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=687903
03-01 18:14:50.922 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=687903
03-01 18:14:50.922 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=687903
03-01 18:14:50.922 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=687903
03-01 18:14:51.182 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=730736
03-01 18:14:51.192 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=730736
03-01 18:14:51.192 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=730736
03-01 18:14:51.192 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=730736
03-01 18:14:51.192 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=730736
03-01 18:14:51.192 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=730736
03-01 18:14:51.372 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1031792
03-01 18:14:51.372 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1031792
03-01 18:14:51.372 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1031792
03-01 18:14:51.372 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1031792
03-01 18:14:51.382 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1031792
03-01 18:14:51.382 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1031792
03-01 18:14:51.442 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1289840
03-01 18:14:51.442 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1289840
03-01 18:14:51.442 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1289840
03-01 18:14:51.452 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1289840
03-01 18:14:51.452 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1289840
03-01 18:14:51.452 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1289840
03-01 18:14:51.482 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1418864
03-01 18:14:51.482 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1418864
03-01 18:14:51.482 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1418864
03-01 18:14:51.482 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1418864
03-01 18:14:51.482 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1418864
03-01 18:14:51.482 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1418864
03-01 18:14:51.512 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1504880
03-01 18:14:51.512 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1504880
03-01 18:14:51.512 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1504880
03-01 18:14:51.522 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1504880
03-01 18:14:51.522 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1504880
03-01 18:14:51.522 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1504880
03-01 18:14:51.552 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1590896
03-01 18:14:51.552 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1590896
03-01 18:14:51.552 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1633904
03-01 18:14:51.562 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1633904
03-01 18:14:51.602 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1762928
03-01 18:14:51.602 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1762928
03-01 18:14:51.602 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1762928
03-01 18:14:51.632 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1891952
03-01 18:14:51.632 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1891952
03-01 18:14:51.632 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1891952
03-01 18:14:51.662 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1977968
03-01 18:14:51.662 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=1977968
03-01 18:14:51.682 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2063984
03-01 18:14:51.682 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2063984
03-01 18:14:51.712 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2150000
03-01 18:14:51.712 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2150000
03-01 18:14:51.732 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2236016
03-01 18:14:51.742 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2236016
03-01 18:14:51.772 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2365040
03-01 18:14:51.772 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2365040
03-01 18:14:51.772 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2365040
03-01 18:14:51.802 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2494064
03-01 18:14:51.802 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2494064
03-01 18:14:51.802 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2494064
03-01 18:14:51.812 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2537072
03-01 18:14:51.852 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2666096
03-01 18:14:51.852 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2666096
03-01 18:14:51.852 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2666096
03-01 18:14:51.882 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2752112
03-01 18:14:51.882 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2752112
03-01 18:14:51.972 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2967152
03-01 18:14:51.972 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2967152
03-01 18:14:51.972 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2967152
03-01 18:14:51.972 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=2967152
03-01 18:14:51.972 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3012208
03-01 18:14:52.012 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3096176
03-01 18:14:52.012 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3096176
03-01 18:14:52.012 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3096176
03-01 18:14:52.062 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3182192
03-01 18:14:52.062 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3182192
03-01 18:14:52.092 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3268208
03-01 18:14:52.092 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3311216
03-01 18:14:52.102 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3354224
03-01 18:14:52.112 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3354224
03-01 18:14:52.142 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3526256
03-01 18:14:52.142 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3526256
03-01 18:14:52.142 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3526256
03-01 18:14:52.142 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3526256
03-01 18:14:52.172 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3612272
03-01 18:14:52.172 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3612272
03-01 18:14:52.202 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3698288
03-01 18:14:52.202 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3698288
03-01 18:14:52.232 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3784304
03-01 18:14:52.232 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3784304
03-01 18:14:52.272 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3870320
03-01 18:14:52.272 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=3870320
03-01 18:14:52.302 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=4001392
03-01 18:14:52.302 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=4001392
03-01 18:14:52.302 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=4001392
03-01 18:14:52.332 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=4085360
03-01 18:14:52.332 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=4085360
03-01 18:14:52.352 32464-3128/com.insta360.explore I/CameraActivity: blockComplete()-903804433
03-01 18:14:52.372 32464-32464/com.insta360.explore I/CameraActivity: long progress() soFarBytes=4156109
03-01 18:14:52.372 32464-32464/com.insta360.explore I/CameraActivity: completed()-903804433
hi,
i'am using your library to download some file( 5-10 MB) and i want to check if there is enough free space before starting download is this possible or i sould check this in progress
and how to stop a download in case there is no space
By default, it will time out after 10s, I need a value longer for this, how can i achieve it? thanks in advance.
After losing connection, all of my files which are downloading serially stop download, i also set retry download too, but it doesn't work
比如,串行下载中,停止串行下载,开始普通的单任务下载?
First time when start
is called - connected in listener has been fired two times from main application process and then from filedownloader process. Second time start
works as intended. But when you do Force stop in App info, you can simulate this again.
//download file
int downloadId = FileDownloader.getImpl()
.create(...)
.setPath(...)
.setListener(mQueueTarget)
.setTag(...).ready();
//start downloading parallel
FileDownloader.getImpl().start(mQueueTarget, false);
mQueueTarget listener:
@Override
protected void connected(BaseDownloadTask task, String etag, boolean isContinue, int soFarBytes, int totalBytes) {
Log.d("DownloadService.connected()", " Etag " + etag + ", pid " + android.os.Process.myPid());
}
...
Also other listener overriden methods like progress are called twice (causes problems on UI)
Log output:
02-26 12:58:55.800 D/DownloadService.connected(): at Etag "56cfffaf-22a7f", pid 26967
02-26 12:58:55.801 D/DownloadService.connected(): at Etag "56cfffaf-22a7f", pid 26473
It looks like FileDownloader.init(this) will duplicate Application class on first download (Application onCreate will be called again while main process still exists, I do not want reinitialize all libraries etc. in onCreate).
Temporary fix we have applied:
<service
android:name="com.liulishuo.filedownloader.services.FileDownloadService"
tools:remove="process" />
@Jacksgong Android 6.0 下载好像不行
I tried video download but it cant continue the last breakpoint/soFarBytes. Is this possible?
Thanks.
hi , i was wondering if i can use your library to download file with a service and show progress in notification
如上HTTP地址,下载时无法重定向与下载,是否需要设置什么参数
神奇的手机- - 重启后又可以了...
当内存不足时,怎么处理?
Very helpful to me, thank you very much!
I found that FileDownloadRunnable class have a addHeader() method, but I can't figure out how to use it!
could give me an example?
因为公司还在用eclipse,我将类都手动导入后 只有FileDownloadServiceUIGuard和另外两个相关联的类报错,FileDownloadServiceUIGuard extends BaseFileServiceUIGuard<FileDownloadServiceUIGuard.FileDownloadServiceCallback, IFileDownloadIPCService>这段一直无法进行修正,请问是什么原因呢?
现在OkHtttp3.0出来了,可更新到最新版本吗
How to add authentication header using the addHeader()
method?
I think making FileDownloadTask public would be very beneficial, it would allow extending this class for custom usage of the library
您好,使用了一下您写的代码,感觉很棒。有一个疑问,就是我用完之后,不需要在程序退出什么的释放一下资源么?
Hi,
Nice work on this.
If we wanted to have a file downloaded that was about 2G, how would we go in achieving this? Would we be splitting and downloading in parts?
Thanks,
Will
文件下载
how to resume download list
请问现在有没有什么广播机制可以获取下载情况?需求是想在其他界面也能收到下载状态改变的通知。
hi 大神:
例如:
某个Activity里面多个下载Task,开启下载后,退出当前Activity(不暂停任务),这个时候再进入当前Activity, 如何对我所有Task重新设置监听,可以收到之前下载的回调? 还是需要自己手动记录Id,重新start设置监听?
Logcat output:
FATAL EXCEPTION: pool-2-thread-1 Process: ir.sobhe.menbar, PID: 6187 java.util.ConcurrentModificationException at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:573) at com.liulishuo.filedownloader.FileDownloadTask$FileDownloadInternalLis.callback(FileDownloadTask.java:213) at com.liulishuo.filedownloader.event.DownloadEventSampleListener.callback(DownloadEventSampleListener.java:36) at com.liulishuo.filedownloader.event.DownloadEventPoolImpl.trigger(DownloadEventPoolImpl.java:192) at com.liulishuo.filedownloader.event.DownloadEventPoolImpl.publish(DownloadEventPoolImpl.java:128) at com.liulishuo.filedownloader.FileDownloadEventPool.publish(FileDownloadEventPool.java:111) at com.liulishuo.filedownloader.event.DownloadEventPoolImpl$2.run(DownloadEventPoolImpl.java:159) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)
看您在文档说调用pause再次调用start即可自动断点续传
我调用这句之后 FileDownloader.getImpl().pause(downloadId);
请问一下我在怎么开启这个downloadId任务。。
我的需求就是 wifi断开再次连接可以自动续传。。。
已经在application里面初始化,在manifest里面注册了服务。想知道还有什么给遗漏的吗?
03-08 09:14:14.136: W/System.err(4268): java.lang.NullPointerException
03-08 09:14:14.136: W/System.err(4268): at android.content.ComponentName.(ComponentName.java:77)
03-08 09:14:14.136: W/System.err(4268): at android.content.Intent.(Intent.java:3813)
03-08 09:14:14.136: W/System.err(4268): at com.liulishuo.filedownloader.services.BaseFileServiceUIGuard.bindStartByContext(BaseFileServiceUIGuard.java:128)
03-08 09:14:14.136: W/System.err(4268): at com.liulishuo.filedownloader.services.BaseFileServiceUIGuard.bindStartByContext(BaseFileServiceUIGuard.java:120)
03-08 09:14:14.140: W/System.err(4268): at com.liulishuo.filedownloader.FileDownloadTask._checkCanStart(FileDownloadTask.java:106)
03-08 09:14:14.140: W/System.err(4268): at com.liulishuo.filedownloader.BaseDownloadTask._start(BaseDownloadTask.java:586)
03-08 09:14:14.140: W/System.err(4268): at com.liulishuo.filedownloader.BaseDownloadTask.access$000(BaseDownloadTask.java:37)
03-08 09:14:14.140: W/System.err(4268): at com.liulishuo.filedownloader.BaseDownloadTask$1.callback(BaseDownloadTask.java:97)
03-08 09:14:14.140: W/System.err(4268): at com.liulishuo.filedownloader.event.DownloadEventPoolImpl.trigger(DownloadEventPoolImpl.java:192)
03-08 09:14:14.144: W/System.err(4268): at com.liulishuo.filedownloader.event.DownloadEventPoolImpl.publish(DownloadEventPoolImpl.java:128)
03-08 09:14:14.144: W/System.err(4268): at com.liulishuo.filedownloader.FileDownloadEventPool.publish(FileDownloadEventPool.java:111)
03-08 09:14:14.144: W/System.err(4268): at com.liulishuo.filedownloader.FileDownloadEventPool$1.run(FileDownloadEventPool.java:68)
03-08 09:14:14.144: W/System.err(4268): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
03-08 09:14:14.144: W/System.err(4268): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
03-08 09:14:14.144: W/System.err(4268): at java.lang.Thread.run(Thread.java:841)
03-08 09:14:14.168: E/FileDownloader.FileDownloadList(4268): remove error, not exist: 1996760519@com.liulishuo.filedownloader.FileDownloadTask@4a870f0c
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ android.os.DeadObjectException
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at android.os.BinderProxy.transactNative(Native Method)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at android.os.BinderProxy.transact(Binder.java:496)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at com.liulishuo.filedownloader.i.IFileDownloadIPCService$Stub$Proxy.unregisterCallback(IFileDownloadIPCService.java:220)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at com.liulishuo.filedownloader.FileDownloadServiceUIGuard.unregisterCallback(FileDownloadServiceUIGuard.java:66)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at com.liulishuo.filedownloader.FileDownloadServiceUIGuard.unregisterCallback(FileDownloadServiceUIGuard.java:35)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at com.liulishuo.filedownloader.services.BaseFileServiceUIGuard.releaseConnect(BaseFileServiceUIGuard.java:99)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at com.liulishuo.filedownloader.services.BaseFileServiceUIGuard.onServiceDisconnected(BaseFileServiceUIGuard.java:93)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1208)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1222)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at android.os.Handler.handleCallback(Handler.java:739)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:95)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at android.os.Looper.loop(Looper.java:135)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5221)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at java.lang.reflect.Method.invoke(Native Method)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:372)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
02-29 10:54:51.798 8463-8463/com.cleverm.smartpen W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
I get the a SocketTimeoutException on large file downloads. Setting the setCallbackProgressTimes() and setAutoRetryTimes() on FileDownloader.getImpl() to large values did not seem to help. Any advice on how to avoid this exception?
断点续传只有eTag判断么? ,现在我们cdn有个问题, ETAG标识一直返回空, 所以断点续传一直失败,但是我用浏览器下载此文件,是可以断点续传的
我下载了你的demo代码,我现在写代码过程中,在你的MainActivity里面有这句FileDownloadMonitor.setGlobalMonitor(GlobalMonitor.getImpl());,我就引用你demo里的library。但是引用library总是会报错呀!
android {
compileSdkVersion COMPILE_SDK_VERSION as int
buildToolsVersion BUILD_TOOLS_VERSION as String
defaultConfig {
minSdkVersion 8
targetSdkVersion COMPILE_SDK_VERSION as int
versionCode VERSION_CODE as int
versionName VERSION_NAME as String
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.squareup.okhttp3:okhttp:3.0.1'
}
apply from: 'https://raw.githubusercontent.com/Jacksgong/JCenter/master/license.gradle'
if (isForUpload2Maven()) {
println ':library:include upload 2 maven methods'
apply from: 'https://raw.githubusercontent.com/Jacksgong/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/Jacksgong/JCenter/master/bintrayv1.gradle'
}
这段代码是在我的工程也是报错的,后来我改成我自己工程里面的
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.baimes.myapplication"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.squareup.okhttp3:okhttp:3.0.1'
}
apply from: 'https://raw.githubusercontent.com/Jacksgong/JCenter/master/license.gradle'
if (isForUpload2Maven()) {
println ':library:include upload 2 maven methods'
apply from: 'https://raw.githubusercontent.com/Jacksgong/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/Jacksgong/JCenter/master/bintrayv1.gradle'
}
还是总报错,并且你demo里面的library,总是无法再我的工程里面把他设置成modulce。。。还请多多指教,说明一下
您好,请帮忙删除/filedownloader/demo/Constant.java中,第40行下载地址代码好吗,这是内部链接,麻烦您了,cx开头的。
protected void FileDownloadManager() {
if (isNetworkAvailable()) {
String[] URLS = {
"http://www.test............mp3",
"http://www.test2..........mp3"};
downloadListener = createLis();
int i = 0;
for (String url : URLS) {
FileDownloader.getImpl().create(url)
.setPath(locationCreation() + File.separator + url.substring(url.lastIndexOf("/") + 1))
.setListener(downloadListener)
.setAutoRetryTimes(1)
.setTag(i + 1)
.setCallbackProgressTimes(1)
.ready();
i++;
}
FileDownloader.getImpl().start(downloadListener, true);
}
}
private FileDownloadListener createLis() {
return new FileDownloadListener() {
@Override
protected void pending(BaseDownloadTask task, int soFarBytes, int totalBytes) {
if (task.getListener() != downloadListener) {
return;
}
Log.d(TAG, "pending() :" + task.getTag());
}
@Override
protected void connected(BaseDownloadTask task, String etag, boolean isContinue, int soFarBytes, int totalBytes) {
super.connected(task, etag, isContinue, soFarBytes, totalBytes);
if (task.getListener() != downloadListener) {
return;
}
Log.d(TAG,"connected() :"+task.getTag());
}
@Override
protected void progress(BaseDownloadTask task, int soFarBytes, int totalBytes) {
if (task.getListener() != downloadListener) {
return;
}
Log.d(TAG,"progress() :"+task.getTag());
}
@Override
protected void blockComplete(BaseDownloadTask task) {
if (task.getListener() != downloadListener) {
return;
}
Log.d(TAG,"blockComplete() :"+task.getTag());
}
@Override
protected void retry(BaseDownloadTask task, Throwable ex, int retryingTimes, int soFarBytes) {
super.retry(task, ex, retryingTimes, soFarBytes);
if (task.getListener() != downloadListener) {
return;
}
Log.d(TAG,"retry() :"+task.getTag());
}
@Override
protected void completed(BaseDownloadTask task) {
if (task.getListener() != downloadListener) {
return;
}
if (task.isReusedOldFile()) {
} else {
}
Log.d(TAG,"completed() :"+task.getTag());
}
@Override
protected void paused(BaseDownloadTask task, int soFarBytes, int totalBytes) {
if (task.getListener() != downloadListener) {
return;
}
Log.d(TAG,"paused() :"+task.getTag());
}
@Override
protected void error(BaseDownloadTask task, Throwable e) {
if (task.getListener() != downloadListener) {
return;
}
Log.d(TAG,"error() :"+task.getTag());
Log.d(TAG, "error() : "+e.getMessage());
}
@Override
protected void warn(BaseDownloadTask task) {
if (task.getListener() != downloadListener) {
return;
}
Log.d(TAG,"warn() :"+task.getTag());
}
};
}
it shows error() : sofar[377462] not equal total[-1]
but it downloads file
Fatal Exception: java.util.IllegalFormatConversionException: %d can't format java.lang.String arguments
at java.util.Formatter.badArgumentType(Formatter.java:1489)
at java.util.Formatter.transformFromInteger(Formatter.java:1689)
at java.util.Formatter.transform(Formatter.java:1461)
at java.util.Formatter.doFormat(Formatter.java:1081)
at java.util.Formatter.format(Formatter.java:1042)
at java.util.Formatter.format(Formatter.java:1011)
at java.lang.String.format(String.java:1803)
at java.lang.String.format(String.java:1777)
at com.liulishuo.filedownloader.util.FileDownloadLog.log(FileDownloadLog.java:64)
at com.liulishuo.filedownloader.util.FileDownloadLog.log(FileDownloadLog.java:55)
at com.liulishuo.filedownloader.util.FileDownloadLog.d(FileDownloadLog.java:43)
at com.liulishuo.filedownloader.FileDownloadEventPool.publish(FileDownloadEventPool.java:100)
at com.liulishuo.filedownloader.FileDownloadEventPool$WaitingRunnable.loopMessage(FileDownloadEventPool.java:372)
at com.liulishuo.filedownloader.FileDownloadEventPool$WaitingRunnable.access$400(FileDownloadEventPool.java:197)
at com.liulishuo.filedownloader.FileDownloadEventPool$WaitingRunnable$1.run(FileDownloadEventPool.java:313)
at android.os.Handler.handleCallback(Handler.java:810)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:189)
at android.app.ActivityThread.main(ActivityThread.java:5532)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.