java.lang.NoSuchFieldError: org.apache.http.message.BasicLineFormatter.INSTANCE

Android发出HTTP请求时出现了这个错误:

java.lang.NoSuchFieldError: org.apache.http.message.BasicLineFormatter.INSTANCE

这是由于使用了CloseableHttpClient造成的,把

CloseableHttpClient httpclient = HttpClients.createDefault();
CloseableHttpResponse httpResponse = httpclient.execute(httpRequest);

替换成

HttpClient httpclient = new DefaultHttpClient();
HttpResponse httpResponse = httpclient.execute(httpRequest);

即可。

CloseableHttpClient在Windows下可以使用,在Android下使用就会出错,原因不明。

上一篇:bootStrap Table 如何使用


下一篇:mysql 更新语句中加判断条件