最新消息:20210917 已从crifan.com换到crifan.org

[已解决]xutils3网络出错OnError The url not be support

Uncategorized crifan 3093浏览 0评论

后来发现是:

The url not be support

搜:

xutils3 The url not be support

xUtils3/UriRequestFactory.java at master · wyouflf/xUtils3 · GitHub

android Xutils Http模块分析 – H291850336的专栏 – 博客频道 – CSDN.NET

if (scheme.startsWith("http")) {
return new HttpRequest(params, loadType);
                } else if (scheme.equals("assets")) {
return new AssetsRequest(params, loadType);
                } else if (scheme.equals("file")) {
return new LocalFileRequest(params, loadType);
                } else {
throw new IllegalArgumentException("The url not be support: " + uri);
                }
            }
        } else {
throw new IllegalArgumentException("The url not be support: " + uri);
        }
    }
public static UriRequest getUriRequest(RequestParams params, Type loadType) throws Throwable {  
       String uri = params.getUri();  
       if (uri.startsWith("http")) {  
           return new HttpRequest(params, loadType);  
       } else if (uri.startsWith("assets://")) {  
           if (assetsRequestCls != null) {  
               Constructor<? extends AssetsRequest> constructor  
                       = assetsRequestCls.getConstructor(RequestParams.class, Class.class);  
               return constructor.newInstance(params, loadType);  
           } else {  
               return new AssetsRequest(params, loadType);  
           }  
       } else if (uri.startsWith("file:") || uri.startsWith("/")) {  
           return new LocalFileRequest(params, loadType);  
       } else {  
           throw new IllegalArgumentException("The url not be support: " + uri);  
       }  
   } 

之前url是:

dev.jiandao.im:8080/code

[总结]

最后把url改为加上http的前缀,就可以了:

类似于:

http://dev.jiandao.im:8080/code

转载请注明:在路上 » [已解决]xutils3网络出错OnError The url not be support

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (1)

  1. 我也出现过,检查半天,发现http前面多了一个空格!
    雷锋5年前 (2019-11-01)回复
100 queries in 0.188 seconds, using 23.31MB memory