Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/216.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
&引用;“请求的范围不可满足”;Android错误416中的http get请求错误_Android_Json_Http_Get - Fatal编程技术网

&引用;“请求的范围不可满足”;Android错误416中的http get请求错误

&引用;“请求的范围不可满足”;Android错误416中的http get请求错误,android,json,http,get,Android,Json,Http,Get,我尝试了下面的代码,但它给出了错误 请求的范围不可满足 String paramString = URLEncodedUtils.format(params, "utf-8"); url = url.replace(" ", "+"); // url += "?" + paramString; Log.e("-------------------------->", paramString.toString()); HttpGet httpGet = new HttpGet(url);

我尝试了下面的代码,但它给出了错误 请求的范围不可满足

String paramString = URLEncodedUtils.format(params, "utf-8");
url = url.replace(" ", "+");
//  url += "?" + paramString;
Log.e("-------------------------->", paramString.toString());
HttpGet httpGet = new HttpGet(url);
Log.e("url--- is:-",""+url);
httpGet.setHeader("Accept-Ranges","none");
HttpResponse httpResponse = httpClient.execute(httpGet);

HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();

为什么在请求头中设置“接受范围”?这是一个响应头字段,应该来自服务器。@Danny_ds没有设置头,我在下面得到了错误“请求的范围不可满足”,通过添加httpGet.addHeader(“用户代理”、“Mozilla/5.0(Windows NT 6.3;Trident/7.0;rv:11.0)和Gecko”)得到了解决方案;