Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

targetSDK升级到30后无法正常使用 #506

Open
shijia109 opened this issue Dec 12, 2023 · 10 comments
Open

targetSDK升级到30后无法正常使用 #506

shijia109 opened this issue Dec 12, 2023 · 10 comments

Comments

@shijia109
Copy link

shijia109 commented Dec 12, 2023

OkDownload Version

v1.0.8

Problem Describe

如题,升级targetsdk到30后,demo无法正常下载,log有报错,不知道原因

Log

2023-12-12 20:31:54.511 17274-17274/com.liulishuo.okdownload.sample D/DownloadDispatcher: enqueueLocked for single task: com.liulishuo.okdownload.DownloadTask@ad87d5c1@1@https://cdn.llscdn.com/yy/files/xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk@/storage/emulated/0/Android/data/com.liulishuo.okdownload.sample/cache/null
2023-12-12 20:31:54.513 17274-17378/com.liulishuo.okdownload.sample D/CallbackDispatcher: taskStart: 1
2023-12-12 20:31:54.518 17274-17378/com.liulishuo.okdownload.sample I/TetheringManager: registerTetheringEventCallback:com.liulishuo.okdownload.sample
2023-12-12 20:31:54.559 17274-17378/com.liulishuo.okdownload.sample D/CallbackDispatcher: -----> start trial task(1) {range=[bytes=0-0]}
2023-12-12 20:31:54.861 17274-17378/com.liulishuo.okdownload.sample D/ConnectTrial: task[1] redirect location: null
2023-12-12 20:31:54.863 17274-17378/com.liulishuo.okdownload.sample D/CallbackDispatcher: <----- finish trial task(1) code[206]{accept-ranges=[bytes], access-control-allow-origin=[], access-control-expose-headers=[X-Log, X-Reqid, Content-Length], access-control-max-age=[2592000], cache-control=[public, max-age=31536000], content-disposition=[attachment; filename="xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk"; filename=utf-8''xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk], content-length=[1], content-range=[bytes 0-0/43994005], content-transfer-encoding=[binary], content-type=[application/vnd.android.package-archive], date=[Tue, 12 Dec 2023 12:31:53 GMT], etag=["lspklu1kkBkLwQipDy2CCLJRtTUl"], last-modified=[Mon, 11 Dec 2017 07:58:13 GMT], server=[openresty], timing-allow-origin=[], x-bill=[Tbl:llss;FileType:0], x-cache=[HIT from BC31_dx-jiangsu-xuzhou-22-cache-1(baishan)], x-log=[X-Log], x-m-log=[QNM:xs1171;QNM3:56], x-m-reqid=[NIkAADsfwreUfJ0X], x-qnm-cache=[MissFg], x-reqid=[uLsAAACi528BzpcX], x-ser=[BC146_dx-lt-yd-jiangsu-huaian-25-cache-2, BC31_dx-jiangsu-xuzhou-22-cache-1]}
2023-12-12 20:31:54.863 17274-17378/com.liulishuo.okdownload.sample D/DownloadDispatcher: is file conflict after run: 1
2023-12-12 20:31:54.864 17274-17378/com.liulishuo.okdownload.sample D/DownloadCall: breakpoint invalid: download from beginning because of local check is dirty 1 fileExist[true] infoRight[false] outputStreamSupport[true] com.liulishuo.okdownload.core.download.BreakpointLocalCheck@fee54b0
2023-12-12 20:31:54.875 17274-17378/com.liulishuo.okdownload.sample D/CallbackDispatcher: downloadFromBeginning: 1
2023-12-12 20:31:54.877 17274-17391/com.liulishuo.okdownload.sample D/DownloadChain: create connection on url: https://cdn.llscdn.com/yy/files/xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk
2023-12-12 20:31:54.878 17274-17391/com.liulishuo.okdownload.sample D/HeaderInterceptor: AssembleHeaderRange (1) block(2) downloadFrom(29329337) currentOffset(0)
2023-12-12 20:31:54.878 17274-17391/com.liulishuo.okdownload.sample D/CallbackDispatcher: -----> start connection task(1) block(2) {if-match=["lspklu1kkBkLwQipDy2CCLJRtTUl"], range=[bytes=29329337-43994004]}
2023-12-12 20:31:54.879 17274-17390/com.liulishuo.okdownload.sample D/DownloadChain: create connection on url: https://cdn.llscdn.com/yy/files/xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk
2023-12-12 20:31:54.880 17274-17389/com.liulishuo.okdownload.sample D/DownloadChain: create connection on url: https://cdn.llscdn.com/yy/files/xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk
2023-12-12 20:31:54.882 17274-17390/com.liulishuo.okdownload.sample D/HeaderInterceptor: AssembleHeaderRange (1) block(1) downloadFrom(14664669) currentOffset(0)
2023-12-12 20:31:54.882 17274-17389/com.liulishuo.okdownload.sample D/HeaderInterceptor: AssembleHeaderRange (1) block(0) downloadFrom(0) currentOffset(0)
2023-12-12 20:31:54.882 17274-17390/com.liulishuo.okdownload.sample D/CallbackDispatcher: -----> start connection task(1) block(1) {if-match=["lspklu1kkBkLwQipDy2CCLJRtTUl"], range=[bytes=14664669-29329336]}
2023-12-12 20:31:54.882 17274-17389/com.liulishuo.okdownload.sample D/CallbackDispatcher: -----> start connection task(1) block(0) {if-match=["lspklu1kkBkLwQipDy2CCLJRtTUl"], range=[bytes=0-14664668]}
2023-12-12 20:31:54.920 17274-17391/com.liulishuo.okdownload.sample D/CallbackDispatcher: <----- finish connection task(1) block(2) code[206]{accept-ranges=[bytes], access-control-allow-origin=[
], access-control-expose-headers=[X-Log, X-Reqid, Content-Length], access-control-max-age=[2592000], cache-control=[public, max-age=31536000], content-disposition=[attachment; filename="xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk"; filename*=utf-8''xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk], content-length=[14664668], content-range=[bytes 29329337-43994004/43994005], content-transfer-encoding=[binary], content-type=[application/vnd.android.package-archive], date=[Tue, 12 Dec 2023 12:31:53 GMT], etag=["lspklu1kkBkLwQipDy2CCLJRtTUl"], last-modified=[Mon, 11 Dec 2017 07:58:13 GMT], server=[openresty], timing-allow-origin=[], x-bill=[Tbl:llss;FileType:0], x-cache=[HIT from BC31_dx-jiangsu-xuzhou-22-cache-1(baishan)], x-log=[X-Log], x-m-log=[QNM:xs1171;QNM3:56], x-m-reqid=[NIkAADsfwreUfJ0X], x-qnm-cache=[MissFg], x-reqid=[uLsAAACi528BzpcX], x-ser=[BC146_dx-lt-yd-jiangsu-huaian-25-cache-2, BC31_dx-jiangsu-xuzhou-22-cache-1]}
2023-12-12 20:31:54.920 17274-17391/com.liulishuo.okdownload.sample D/CallbackDispatcher: fetchStart: 1
2023-12-12 20:31:54.921 17274-17391/com.liulishuo.okdownload.sample D/MultiPointOutputStream: Create new file: xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk
2023-12-12 20:31:54.923 17274-17391/com.liulishuo.okdownload.sample D/MultiPointOutputStream: Create output stream write from (1) block(2) 29329337
2023-12-12 20:31:54.926 17274-17391/com.liulishuo.okdownload.sample W/DownloadUriOutputStream: fallocate() not supported; falling back to ftruncate()
2023-12-12 20:31:54.927 17274-17392/com.liulishuo.okdownload.sample D/MultiPointOutputStream: OutputStream start flush looper task[1] with syncBufferIntervalMills[2000] syncBufferSize[65536]
2023-12-12 20:31:54.928 17274-17392/com.liulishuo.okdownload.sample D/MultiPointOutputStream: OutputStream sync success (1) block(2) syncLength(4096) currentOffset(4096)
2023-12-12 20:31:55.140 17274-17390/com.liulishuo.okdownload.sample D/CallbackDispatcher: <----- finish connection task(1) block(1) code[206]{accept-ranges=[bytes], access-control-allow-origin=[
], access-control-expose-headers=[X-Log, X-Reqid, Content-Length], access-control-max-age=[2592000], cache-control=[public, max-age=31536000], content-disposition=[attachment; filename="xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk"; filename*=utf-8''xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk], content-length=[14664668], content-range=[bytes 14664669-29329336/43994005], content-transfer-encoding=[binary], content-type=[application/vnd.android.package-archive], date=[Tue, 12 Dec 2023 12:31:53 GMT], etag=["lspklu1kkBkLwQipDy2CCLJRtTUl"], last-modified=[Mon, 11 Dec 2017 07:58:13 GMT], server=[openresty], timing-allow-origin=[], x-bill=[Tbl:llss;FileType:0], x-cache=[HIT from BC31_dx-jiangsu-xuzhou-22-cache-1(baishan)], x-log=[X-Log], x-m-log=[QNM:xs1171;QNM3:56], x-m-reqid=[NIkAADsfwreUfJ0X], x-qnm-cache=[MissFg], x-reqid=[uLsAAACi528BzpcX], x-ser=[BC146_dx-lt-yd-jiangsu-huaian-25-cache-2, BC31_dx-jiangsu-xuzhou-22-cache-1]}
2023-12-12 20:31:55.140 17274-17390/com.liulishuo.okdownload.sample D/CallbackDispatcher: fetchStart: 1
2023-12-12 20:31:55.144 17274-17389/com.liulishuo.okdownload.sample D/CallbackDispatcher: <----- finish connection task(1) block(0) code[206]{accept-ranges=[bytes], access-control-allow-origin=[
], access-control-expose-headers=[X-Log, X-Reqid, Content-Length], access-control-max-age=[2592000], cache-control=[public, max-age=31536000], content-disposition=[attachment; filename="xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk"; filename*=utf-8''xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk], content-length=[14664669], content-range=[bytes 0-14664668/43994005], content-transfer-encoding=[binary], content-type=[application/vnd.android.package-archive], date=[Tue, 12 Dec 2023 12:31:53 GMT], etag=["lspklu1kkBkLwQipDy2CCLJRtTUl"], last-modified=[Mon, 11 Dec 2017 07:58:13 GMT], server=[openresty], timing-allow-origin=[*], x-bill=[Tbl:llss;FileType:0], x-cache=[HIT from BC31_dx-jiangsu-xuzhou-22-cache-1(baishan)], x-log=[X-Log], x-m-log=[QNM:xs1171;QNM3:56], x-m-reqid=[NIkAADsfwreUfJ0X], x-qnm-cache=[MissFg], x-reqid=[uLsAAACi528BzpcX], x-ser=[BC146_dx-lt-yd-jiangsu-huaian-25-cache-2, BC31_dx-jiangsu-xuzhou-22-cache-1]}
2023-12-12 20:31:55.144 17274-17389/com.liulishuo.okdownload.sample D/CallbackDispatcher: fetchStart: 1
2023-12-12 20:31:55.147 17274-17390/com.liulishuo.okdownload.sample D/MultiPointOutputStream: Create output stream write from (1) block(1) 14664669
2023-12-12 20:31:56.030 17274-17354/com.liulishuo.okdownload.sample D/RemitSyncExecutor: sync info with id: 1
2023-12-12 20:31:56.928 17274-17392/com.liulishuo.okdownload.sample D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 0
2023-12-12 20:31:57.139 17274-17392/com.liulishuo.okdownload.sample D/MultiPointOutputStream: OutputStream sync success (1) block(0) syncLength(5290874) currentOffset(5290874)
2023-12-12 20:31:57.140 17274-17392/com.liulishuo.okdownload.sample D/MultiPointOutputStream: OutputStream sync success (1) block(1) syncLength(7043955) currentOffset(7043955)
2023-12-12 20:31:57.141 17274-17392/com.liulishuo.okdownload.sample D/MultiPointOutputStream: OutputStream sync success (1) block(2) syncLength(11660111) currentOffset(11664207)
2023-12-12 20:31:57.831 17274-17391/com.liulishuo.okdownload.sample D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 1
2023-12-12 20:31:57.831 17274-17392/com.liulishuo.okdownload.sample D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 1
2023-12-12 20:31:57.831 17274-17392/com.liulishuo.okdownload.sample D/MultiPointOutputStream: runSync state change isNoMoreStream[false] newNoMoreStreamBlockList[[2]]
2023-12-12 20:31:57.845 17274-17392/com.liulishuo.okdownload.sample D/MultiPointOutputStream: OutputStream sync success (1) block(0) syncLength(3244032) currentOffset(8534906)
2023-12-12 20:31:57.845 17274-17392/com.liulishuo.okdownload.sample D/MultiPointOutputStream: OutputStream sync success (1) block(1) syncLength(2228224) currentOffset(9272179)
2023-12-12 20:31:57.846 17274-17392/com.liulishuo.okdownload.sample D/MultiPointOutputStream: OutputStream sync success (1) block(2) syncLength(3000461) currentOffset(14664668)
2023-12-12 20:31:57.846 17274-17391/com.liulishuo.okdownload.sample D/MultiPointOutputStream: OutputStream close task[1] block[2]
2023-12-12 20:31:57.846 17274-17391/com.liulishuo.okdownload.sample D/CallbackDispatcher: fetchEnd: 1
2023-12-12 20:31:57.847 17274-17404/com.liulishuo.okdownload.sample D/DownloadChain: release connection com.liulishuo.okdownload.core.connection.DownloadOkHttp3Connection@94b4a61 task[1] block[2]
2023-12-12 20:31:58.729 17274-17389/com.liulishuo.okdownload.sample D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 2
2023-12-12 20:31:58.730 17274-17392/com.liulishuo.okdownload.sample D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 2
2023-12-12 20:31:58.730 17274-17392/com.liulishuo.okdownload.sample D/MultiPointOutputStream: runSync state change isNoMoreStream[false] newNoMoreStreamBlockList[[0]]
2023-12-12 20:31:58.840 17274-17390/com.liulishuo.okdownload.sample D/MultiPointOutputStream: OutputStream done but no need to ensure sync, because the syncFuture.isDone[true] task[1] block[1]
2023-12-12 20:31:58.841 17274-17390/com.liulishuo.okdownload.sample D/MultiPointOutputStream: OutputStream close task[1] block[1]
2023-12-12 20:31:58.841 17274-17390/com.liulishuo.okdownload.sample D/DownloadCache: catch unknown error java.io.IOException: The current offset on block-info isn't update correct, 9272179 != 14664668 on 1
2023-12-12 20:31:58.842 17274-17404/com.liulishuo.okdownload.sample D/DownloadChain: release connection com.liulishuo.okdownload.core.connection.DownloadOkHttp3Connection@dbe6986 task[1] block[1]

@shijia109
Copy link
Author

进度条到头后会报error,说什么长度不一致,再进来重新下载,进度条会回退一部分然后再前进,概率性会complete,大多数情况下会error,或进度到头后无任何反应

@shijia109
Copy link
Author

shijia109 commented Dec 13, 2023

经测试,api到29就无法正常工作,而demo的api是28,但是现在应用商店硬性要求api必须30或以上,这就非常麻烦了,换框架成本太高,作者能关注下这个问题吗?这么好的东西就因为适配问题无法被人使用,太可惜了

@shijia109
Copy link
Author

自己改的代码,解决了,为啥不直接改了呢?我看21年还有提交,20年就有人反馈这个问题而且还有方案了

@Cancrileo
Copy link

怎么改的 求解

自己改的代码,解决了,为啥不直接改了呢?我看21年还有提交,20年就有人反馈这个问题而且还有方案了

@gumaola
Copy link

gumaola commented Dec 21, 2023

库的原作者已经重新fork并更新了所有sdk,贡献度第一的就是

@shijia109
Copy link
Author

怎么改的 求解

自己改的代码,解决了,为啥不直接改了呢?我看21年还有提交,20年就有人反馈这个问题而且还有方案了

MultiPointOutputStream这个类的close方法 outputStreamMap.remove(blockIndex)之后在加一行noSyncLengthMap.remove(blockIndex);

@tianshaokai
Copy link

@Cancrileo https://github.com/tianshaokai/okdownload 我已经改了,里边改了两个地方

@shijia109
Copy link
Author

库的原作者已经重新fork并更新了所有sdk,贡献度第一的就是

下载下来了,但是项目跑不起来,各种莫名其妙报错,解决一个又出另一个,总之无法编译,不知道差哪了

@tianshaokai
Copy link

tianshaokai commented Jan 18, 2024

@shijia109 可以看看我的代码 https://github.com/tianshaokai/okdownload ,改成 了 androidx

@shijia109
Copy link
Author

@shijia109 可以看看我的代码 https://github.com/tianshaokai/okdownload ,改成 了 androidx

感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants