Giter Site home page Giter Site logo

Comments (11)

yanzhenjie avatar yanzhenjie commented on July 28, 2024 1

我前面看错分钟成秒了,你的超时时间并不短。

看你使用的OkHttp作为底层,我搜了一下,这个有可能是OkHttp的问题:
square/okhttp#3974

你把底层切换为URLConnection试试看这个问题还出现吗,另外URLConnection作为底层时,在Android4.4以下的系统中,DELETE请求不支持上行body。

from kalle.

fairytale110 avatar fairytale110 commented on July 28, 2024

宽带WIFI不会有问题

from kalle.

yanzhenjie avatar yanzhenjie commented on July 28, 2024

具体异常信息是什么?

from kalle.

fairytale110 avatar fairytale110 commented on July 28, 2024

image

image

from kalle.

yanzhenjie avatar yanzhenjie commented on July 28, 2024

超时了呀,不是文件被占用就是网络不好,链接服务器不稳定。大多数是后者。

from kalle.

fairytale110 avatar fairytale110 commented on July 28, 2024

图片选择用的您的Album库,应该不存在文件被占用吧?网络应该不会有问题吧,4G网也不慢,外网WI-FI都能成功上传。刚刚试了下本地局域网也有这个问题。好蛋疼,甲方要演示。

from kalle.

fairytale110 avatar fairytale110 commented on July 28, 2024

这是我的图片选择封装方法

image

这是我调用的地方

image

这是我的上传业务部分

image

请教下我这样的使用是否存在问题而导致报错呢?

from kalle.

yanzhenjie avatar yanzhenjie commented on July 28, 2024

应该是网络超时,你把超时时间设置长一点。

from kalle.

fairytale110 avatar fairytale110 commented on July 28, 2024

你好,在kalle在Application初始化时设置了超时为3分钟,如图,这样是有效的吗,但是好像对问题提到的报错没有什么影响,大概三十秒不到就报错了。

image

from kalle.

fairytale110 avatar fairytale110 commented on July 28, 2024

果然是OkHttp的坑,换成

AppConfig.get().initFileDir();
            Kalle.setConfig(KalleConfig.newBuilder()
                    .connectFactory(URLConnectionFactory.newBuilder().build())
                    .cookieStore(DBCookieStore.newBuilder(this).build())
                    .cacheStore(DiskCacheStore.newBuilder(AppConfig.get().PATH_APP_CACHE).build())
                    .network(new BroadcastNetwork(this))
                    //.addInterceptor(new LoginInterceptor())//自动重新登录拦截器
                    // 可以添加 请求失败自动重试拦截器
                    .addInterceptor(new LoggerInterceptor("EB-HTTP", BuildConfig.DEBUG))
                    .addInterceptor(new RetryInterceptor(3))
                    .converter(new JsonConverter(this))
                    .connectionTimeout(3, TimeUnit.MINUTES)
                    .readTimeout(3, TimeUnit.MINUTES)
                    .build());

from kalle.

fairytale110 avatar fairytale110 commented on July 28, 2024

就可以了,十分感谢您

from kalle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.