httpclient4.1.jar和httpclient4.2.3.jar中的冲突

时间:2014-09-10 20:49:05

标签: java android eclipse

在下面第2行:

当我在我的libs中使用httpclient4.1.jar时,删除了setRedirectStrategy错误并且发生了laxRedirect错误(并且laxRedirect导入也出错) - 下面的错误(1),

当我使用httpclient4.2.3时,删除了laxredirect错误并且发生了setRedirectStrategy错误 - 错误(2)。

我怎么办? (使用4.1或4.2.3,必须完成哪些chages?)

DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.setRedirectStrategy(new LaxRedirectStrategy());

导入是:

    import org.apache.http.impl.client.LaxRedirectStrategy;
import org.apache.http.impl.client.DefaultHttpClient;

并且错误是:

1- The method setRedirectStrategy(LaxRedirectStrategy) is undefined for the type DefaultHttpClient

2- LaxRedirectStrategy cannot be resolved to a type

1 个答案:

答案 0 :(得分:0)

RedirectStrategy4.1一起推出,现已弃用。所以当你包括4.1 jar setRedirectStrategy时,但4.2.3它没有。

在这种情况下,您无法覆盖系统(Android' s)的实现。所以我建议您引用SO问题No. 1No. 2和{{3 }}