justson / downloader Goto Github PK
View Code? Open in Web Editor NEWA cost-effective Android file downloader
Home Page: https://github.com/Justson/Downloader
License: Apache License 2.0
A cost-effective Android file downloader
Home Page: https://github.com/Justson/Downloader
License: Apache License 2.0
请教一下,用replugin加载后的插件,打开一个网页后下载东西会停到90%多,再点击一下网页就会崩溃,报错信息:
Process: com.qihoo360.replugin.sample.host, PID: 2723
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference
at android.support.v4.content.FileProvider.parsePathStrategy(FileProvider.java:605)
at android.support.v4.content.FileProvider.getPathStrategy(FileProvider.java:579)
at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:417)
at com.just.agentweb.AgentWebUtils.getUriFromFileForN(AgentWebUtils.java:228)
at com.just.agentweb.AgentWebUtils.getUriFromFile(AgentWebUtils.java:220)
at com.just.agentweb.AgentWebUtils.setIntentDataAndType(AgentWebUtils.java:239)
at com.just.agentweb.AgentWebUtils.getCommonFileIntentCompat(AgentWebUtils.java:661)
at com.just.agentweb.download.DefaultDownloadImpl.preDownload(DefaultDownloadImpl.java:212)
at com.just.agentweb.download.DefaultDownloadImpl.onDownloadStartInternal(DefaultDownloadImpl.java:145)
at com.just.agentweb.download.DefaultDownloadImpl.access$000(DefaultDownloadImpl.java:58)
at com.just.agentweb.download.DefaultDownloadImpl$1.run(DefaultDownloadImpl.java:112)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:159)
at android.app.ActivityThread.main(ActivityThread.java:6364)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1096)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:883)
下载apk自动打开失败,第一次成功,第二失败,第三次成功。。。
方法如下:
DownloadImpl.with(App.getInstance())
.url(url)
//自定义路径需指定目录和authority(FileContentProvide),需要相对应匹配才能启动通知,和自动打开文件
.target(file, BuildConfig.APPLICATION_ID + ".provider")
.addHeader("Range", "bytes=0-")//添加请求头
.autoOpenIgnoreMD5()//下载完成后自动打开文件,不做文件校验
.setOpenBreakPointDownload(false)//打开断点续传
.enqueue(new DownloadListenerAdapter()
大佬 我用异步下载一组文件, 在监听结果onResult里面判断下载完毕然后递归循环下一个文件,本来之前是好的,但是最近出现一个问题 ,因为后台配了一些测试数据,这组文件地址有些可能是一样的,这样导致这个文件只能下载一遍,在一次循环中就只能请求一下,第二次好像就请求不到,不能下载了,而且日志没有报错信息,想问下是什么情况
`
2 com.just.agentweb.DefaultDownloadImpl.create()
3 com.just.agentweb.AgentWebSettingsImpl.setDownloader()
4 com.just.agentweb.AgentWeb.ready()
5 com.just.agentweb.AgentWeb.access$3100()
6 com.just.agentweb.AgentWeb$PreAgentWeb.ready()
7 com.movies.k8.fragment.TopicFragment.void inView(android.view.View)()
8 com.movies.k8.fragment.TopicFragment.void initView(android.view.View)()
9 com.movies.k8.fragment.BaseFragment.onCreateView()
10 androidx.fragment.app.Fragment.performCreateView()
11 androidx.fragment.app.FragmentManagerImpl.moveToState()
12 androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState()
13 androidx.fragment.app.FragmentManagerImpl.moveToState()
14 androidx.fragment.app.BackStackRecord.executeOps()
15 androidx.fragment.app.FragmentManagerImpl.executeOps()
16 androidx.fragment.app.FragmentManagerImpl.executeOpsTogether()
17 androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute()
18 androidx.fragment.app.FragmentManagerImpl.execSingleAction()
19 androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss()
20 androidx.fragment.app.FragmentPagerAdapter.finishUpdate()
21 androidx.viewpager.widget.ViewPager.populate()
22 androidx.viewpager.widget.ViewPager.setCurrentItemInternal()
23 androidx.viewpager.widget.ViewPager.setCurrentItemInternal()
24 androidx.viewpager.widget.ViewPager.setCurrentItem()
25 com.chaychan.library.BottomBarLayout$MyOnClickListener.onClick()
26 android.view.View.performClick(View.java:4848)
27 android.view.View$PerformClick.run(View.java:20300)
28 android.os.Handler.handleCallback(Handler.java:815)
29 android.os.Handler.dispatchMessage(Handler.java:104)
30 android.os.Looper.loop(Looper.java:194)
31 android.app.ActivityThread.main(ActivityThread.java:5682)
32 java.lang.reflect.Method.invoke(Native Method)
33 java.lang.reflect.Method.invoke(Method.java:372)
34 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:963)
35 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)
`
dear sir can you please help me i need this project so badly i am struck i have finished my project only download feature is needed i found your repo.. after so many trouble this is the only one which i want in my project my project is targeting android 13 and still i am having problems what am i doing wrong i dont understand .. i have sucsessfully iported your repo in my project and downloading also starts but files are not saving in dir need help i hope you will help me to finish my project need this repo so bad so please cooparete with me i will also buy you a coffee for my pleasure...
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.next(ArrayList.java:860)
at androidx.core.app.NotificationCompatBuilder.(NotificationCompatBuilder.java:99)
at androidx.core.app.NotificationCompat$Builder.build(NotificationCompat.java:1677)
at com.download.library.DownloadNotifier$1.run(DownloadNotifier.java:169)
at android.os.Handler.handleCallback(Handler.java:888)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:213)
at android.os.HandlerThread.run(HandlerThread.java:67)
最近在bugly中反馈了这样的报错。看起来是因为并发引起的
just tell me where file will be saved ? i need this one
我是agentWeb导入的下载 androidX 5.0.3,测试下载还是会报 Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
如题,点击了通知栏的清除,任务出错。注释NotificationCancelReceiver也没用?
Fatal Exception: java.lang.IllegalArgumentException com.monsterindia.seeker.views: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
Please update the DownloadNotifier line 110 PendingIntent with the flag FLAG_IMMUTABLE
我想覆盖,或者断点续传。您可倒好,不受控制的改成别的乱七八糟名字。
(2) xxx.xxx; filename=xxx.xxx
我该怎么解决?
在使用了com.download.library:downloader-androidx:4.1.4 后 ,Google play 被遭到封停!
Your app contains content that doesn’t comply with the Device and Network Abuse policy. We found your app is using a non-compliant version of Loan Download SDK which contains code to download or install applications from unknown sources outside of Google Play.
This only occurs with proguard. I disable proguard in my project and the NoSuchMethodException no longer occurred.
W/System.err: java.lang.NoSuchMethodException: com.jbro129.tmanager.ui.DataViewActivity$e.onProgress [class java.lang.String, long, long, long]
? W/System.err: at java.lang.Class.getMethod(Class.java:2072)
? W/System.err: at java.lang.Class.getDeclaredMethod(Class.java:2050)
? W/System.err: at com.download.library.j$c.run(Unknown Source:43)
? W/System.err: at com.download.library.j$a.run(Unknown Source:7)
? W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
? W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
? W/System.err: at java.lang.Thread.run(Thread.java:919)
The code I put in the onProgress still runs even with the exception.
Here is my onProgress code
@Override
public void onProgress(String url, long downloaded, long length, long usedTime) {
super.onProgress(url, downloaded, length, usedTime);
JLogd("onProgress log");
if (pDialog != null && pDialog.isShowing())
{
float percent = (float) downloaded / length;
pDialog.setProgress((int) (percent * pDialog.getMax()));
}
}
The log shows up in the logcat.
有个问题咨询一下,分块传输指的是像迅雷一样,单文件多线程下载么
比如http://www.xxx.com/xxx 浏览器中会跳转到http://www.xxx.com/yyy.apk 但是调用下载直接保存为xxx了 没有执行跳转。
如果设置 target, DownloadListenerAdapter 的 onResult , 返回 false 无效。 不添加 target 则根据 onResult return 结果执行。
另外 部分手机默认的 target 路径的, 根据返回路径执行安装会提示安装安装包不存在。
I'm using implementation 'com.github.Justson:Downloader:v5.0.3-androidx' // AgentWeb (Downloader)
E/AndroidRuntime: FATAL EXCEPTION: Thread-22
E/AndroidRuntime: Process: ***.***.***, PID: 1851
E/AndroidRuntime: java.lang.IllegalArgumentException: ***.***.***: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/AndroidRuntime: Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
E/AndroidRuntime: at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/AndroidRuntime: at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
E/AndroidRuntime: at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
E/AndroidRuntime: at com.download.library.DownloadNotifier.buildCancelContent(DownloadNotifier.java:147)
E/AndroidRuntime: at com.download.library.DownloadNotifier.initBuilder(DownloadNotifier.java:123)
E/AndroidRuntime: at com.download.library.DownloadTask.createNotifier(DownloadTask.java:508)
E/AndroidRuntime: at com.download.library.DownloadSubmitterImpl$DownloadStartTask.run(DownloadSubmitterImpl.java:178)
E/AndroidRuntime: at com.download.library.DownloadSubmitterImpl$1.run(DownloadSubmitterImpl.java:93)
E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime: at java.lang.Thread.run(Thread.java:920)
DownloadImpl.getInstance(TApplication.instance).url(url)
.setUniquePath(true)
.setForceDownload(true)
.setRetry(3)
.quickProgress()
.autoOpenIgnoreMD5()
.enqueue(object :DownloadListenerAdapter()
override fun onProgress(
url: String?,
downloaded: Long,
length: Long,
usedTime: Long) {
super.onProgress(url, downloaded, length, usedTime)
updateProgress(downloaded.toDouble().div(length.toDouble()).times(100).toInt())
}
override fun onResult(
throwable: Throwable?,
path: Uri?,
url: String?,
extra: Extra?
): Boolean {
throwable?.let {
showToast("下载失败,请重试!")
}
dimissDialog()
return super.onResult(throwable, path, url, extra)
}
需要更新ui的话需要手动切换回去ui线程 runOnUiThread ?
下载一个50MB的文件,中间故意杀进程,以观察断点续传的效果。
试了七八次,有2次最终下载的文件MD5校验失败。
应该是杀进程时文件写入,与下次恢复传输时的校验机制还需要完善
我看xutils里,每次断点续传开始时,会把断点前移512字节,校验本地文件最后的512个字节,是否与服务器上的相同,如果相同则续传,否则放弃重新开始。
使用5.0.4的版本下载文件文件不完整,没有传入md5校验值
Hi i hope you are fine :D
i always get this error "ERROR: Failed to resolve: com.download.library:Downloader:4.1.5"
i add maven { url "https://jitpack.io" }
and i add ::
implementation "com.download.library:Downloader:4.1.5"
but not working
can you help me
thanks
下载文件,进度条会卡住不动
下载视频后,无法找到具体下载目录路径?
请问我批量下载的时候,会报这个提示,但是并不影响下载。
Downloader: API Result error.
下载的时候app异常崩溃,下载中的视频全部归为0,无法继续下载,请问有什么解决办法吗?
java.lang.NoSuchMethodException: com.just.agentweb.DefaultDownloadImpl$4.onProgress [class java.lang.String, long, long, long]
at java.lang.Class.getMethod(Class.java:2072)
at java.lang.Class.getDeclaredMethod(Class.java:2050)
at com.download.library.DownloadSubmitterImpl$DownloadStartTask.run(DownloadSubmitterImpl.java:146)
at com.download.library.DownloadSubmitterImpl$1.run(DownloadSubmitterImpl.java:97)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:929)
虽然说捕获了异常。
if (null != mDownloadTask.getDownloadingListener()) {
try {
Annotation annotation = mDownloadTask.getDownloadingListener().getClass().getDeclaredMethod("onProgress", String.class, long.class, long.class, long.class).getAnnotation(DownloadingListener.MainThread.class);
boolean mCallbackInMainThread = null != annotation;
mDownloader.mCallbackInMainThread = mCallbackInMainThread;
Runtime.getInstance().log(TAG, " callback in main-Thread:" + mCallbackInMainThread);
} catch (Exception e) {
e.printStackTrace();
}
}
Can't download file with SDK 33
跟我设定的目录不一致,应该去掉随机的文件夹这一层文件目录
在3台手机上一台模拟器上,一台正常,2台出现解析包时出现问题。
正常的是xiaomi mix 2x android10 模拟器6.0的系统
出错的一台是Nexus 5X android 7.1.1 另一台出错的是华为的(别人的,比较旧的机子,只是让帮运行一下,同样的问题)
Everything is working great bu can u tell me how to open the file after download??
大佬您好!
使用Downloader时没有找到添加SSL证书的地方,请问是否支持?
内部使用什么网络请求框架?okhttp?
当外部存储不可用时,无法下载保存到内部存储的files下,报错:com.download.library.DownloadException: failed , cause:Insufficient memory space .
计算存储空间那里应该需要兼容一下只有内部存储的情况。
Runtime.java中
private static Pattern DISPOSITION_PATTERN = Pattern.compile(".filename=(.)");
filename没有处理带引号的情况
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.