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

[Bug]:文件下载超时,文件大小7M,浏览器可以下载,但是使用 EasyHttp 下载超时 #188

Closed
jmhe1 opened this issue Jul 1, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@jmhe1
Copy link

jmhe1 commented Jul 1, 2023

框架版本【必填】

EasyHttp:10.2

问题描述【必填】

这是下载链接https://api.hanximeng.com/lanzou/?url=https://ybella.lanzoue.com/iDkDJ0e0ro3e&pwd=1234&type=down
怎么都下载不了,一直超时,此时的官方demo也试了,也是超时

复现步骤【必填】

File file = new File(getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS), "sadf.ttf");
EasyHttp.download(this)
.method(HttpMethod.GET)
.file(file)
//.url("https://qd.myapp.com/myapp/qqteam/AndroidQQ/mobileqq_android.apk")
.url("https://api.hanximeng.com/lanzou/?url=https://ybella.lanzoue.com/iDkDJ0e0ro3e&pwd=1234&type=down")
.listener(new OnDownloadListener() {

                    @Override
                    public void onDownloadStart(File file) {
                        mProgressBar.setProgress(0);
                        mProgressBar.setVisibility(View.VISIBLE);
                    }

                    @Override
                    public void onDownloadProgressChange(File file, int progress) {
                        mProgressBar.setProgress(progress);
                    }

                    @Override
                    public void onDownloadSuccess(File file) {
                        Toaster.show("下载成功:" + file.getPath());
                        installApk(MainActivity.this, file);
                    }

                    @Override
                    public void onDownloadFail(File file, Exception e) {
                        Toaster.show("下载失败:" + e.getMessage());
                        if (e instanceof FileMd5Exception) {
                            // 如果是文件 md5 校验失败,则删除文件
                            file.delete();
                        }
                    }

                    @Override
                    public void onDownloadEnd(File file) {
                        mProgressBar.setVisibility(View.GONE);
                    }
                })
                .start();

是否必现【必填】

项目 targetSdkVersion【必填】

31

出现问题的手机信息【必填】

华为

出现问题的安卓版本【必填】

8.0

问题信息的来源渠道【必填】

No response

是部分机型还是所有机型都会出现【必答】

全部

框架最新的版本是否存在这个问题【必答】

框架文档是否提及了该问题【必答】

是否已经查阅框架文档但还未能解决的【必答】

issue 列表中是否有人曾提过类似的问题【必答】

是否已经搜索过了 issue 列表但还未能解决的【必答】

未选择

是否可以通过 Demo 来复现该问题【必答】

提供报错堆栈

No response

提供截图或视频

No response

提供解决方案

No response

@jmhe1 jmhe1 added the bug Something isn't working label Jul 1, 2023
@getActivity
Copy link
Owner

image image

@getActivity
Copy link
Owner

2023-07-02 11:11:02.644 15597-16359/com.hjq.easy.demo E/EasyHttp DownloadApi@2201235: Unable to resolve host "api.hanximeng.com": No address associated with hostname
2023-07-02 11:11:02.654 15597-16359/com.hjq.easy.demo E/EasyHttp DownloadApi@2201235: 服务器连接异常,请稍后再试
    com.hjq.http.exception.ServerException: 服务器连接异常,请稍后再试
        at com.hjq.easy.demo.http.model.RequestHandler.requestFail(RequestHandler.java:162)
        at com.hjq.easy.demo.http.model.RequestHandler.downloadFail(RequestHandler.java:196)
        at com.hjq.http.callback.DownloadCallback.onFailure(DownloadCallback.java:163)
        at com.hjq.http.callback.BaseCallback.onFailure(BaseCallback.java:98)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:211)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        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:920)
     Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
        at libcore.io.Linux.android_getaddrinfo(Native Method)
        at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:136)
        at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:221)
        at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:136)
        at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135)
        at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
        at java.net.InetAddress.getAllByName(InetAddress.java:1152)
        at okhttp3.Dns$1.lookup(Dns.java:40)
        at okhttp3.internal.connection.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:185)
        at okhttp3.internal.connection.RouteSelector.nextProxy(RouteSelector.java:149)
        at okhttp3.internal.connection.RouteSelector.next(RouteSelector.java:84)
        at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:215)
        at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
        at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:127)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:257)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:201)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 
        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:920) 

@getActivity
Copy link
Owner

getActivity commented Jul 2, 2023

小伙子,这个是 DNS 的问题,一看就是服务器的问题,和框架没有什么关系,需要你自行排查和解决,我目前只处理框架的 Bug 和建议。

@jmhe1
Copy link
Author

jmhe1 commented Jul 3, 2023

好的,谢谢大神

@getActivity getActivity changed the title [Bug]:文件下载超时,文件大小7M,浏览器可以下载,但是使用EasyHtt下载超时 [Bug]:文件下载超时,文件大小7M,浏览器可以下载,但是使用 EasyHttp 下载超时 Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants