关于kotlin接口超时问题

手机端recyclerView一直没数据,try catch出来就是这个问题

img


apifox查询到的数据

img

不存在服务器关闭的情况下,,在java项目中能运行接口的,在网上搜添加了以下内容

img

手机有网,请问怎么解决,,难道是解析问题.?

你超时时间设置的多少?6ms?你接口这么快?

1.网上搜索到的配置是为了兼容Android 9.0 +,数据传输必须使用密文。即ssl 传输。 从 Android 9(API 级别 28)开始,系统默认情况下已停用明文支持。

根据楼主贴的异常日志:网络超时时间 failed to connect xxxx xxxx, after 6ms ,需要检查下网络链接的 超时时间设置是否有问题。

sdk 默认链接超时时间单位是毫秒。

例如UrLConnect sdk 。设置超时时间注释,单位 timeout value in milliseconds

     * @param timeout an {@code int} that specifies the connect
     *               timeout value in milliseconds
     * @throws IllegalArgumentException if the timeout parameter is negative
     *
     * @see #getConnectTimeout()
     * @see #connect()
     * @since 1.5
     */
    public void setConnectTimeout(int timeout) {
        if (timeout < 0) {
            throw new IllegalArgumentException("timeout can not be negative");
        }
        connectTimeout = timeout;
    }