zoukankan      html  css  js  c++  java
  • android GET 请求在5.0版本的取不到数据,报IO异常兼容问题解决

    使用lib类库xUtils-2.6.10.jar作为数据请求的框架,在android的5.0版会有兼容问题,取不到GET请求的数据。

    但是POST没有问题,难取到数据。

    public static ResponseContext invokeGet(String url,
    			List<NameValuePair> headers) {
    		ResponseContext result = new ResponseContext();
    		try {
    			RequestParams requestParams = new RequestParams();
    			if (headers != null && headers.size() > 0) {
    				requestParams.addBodyParameter(headers);
    			}
    			result = invokeRequest(url, requestParams,
    					HttpRequest.HttpMethod.GET);
    		} catch (Exception e) {
    			String messageString = e.getMessage();
    			result.setMessage(messageString);
    			Log.e(TAG, messageString);
    		}
    		Log.d(TAG, "over");
    		return result;
    	}
    

    调试发现,返回的结果result是null值。

    解决办法:

    升级类库:xUtils-2.6.10.jar--->xUtils-2.6.14.jar

  • 相关阅读:
    page指令
    CMD设IP
    JDBC的几种驱动
    Python的闭包使用
    1189. 扫雷游戏
    1287. 递增的三元子序列
    Pip安装使用国内源的两种方法
    Python Classmethod和Staticmethod函数
    Git提交远程仓库
    Git分支管理
  • 原文地址:https://www.cnblogs.com/mxm2005/p/4877029.html
Copyright © 2011-2022 走看看