2014-09-10 41 views
0

以下線路2:衝突httpclient4.1.jar和httpclient4.2.3.jar

當我使用httpclient4.1.jar在我的庫setRedirectStrategy錯誤刪除,laxRedirect出現錯誤(和laxRedirect進口也採取錯誤)-error(1)所示,

當我使用httpclient4.2.3,laxredirect錯誤取出並setRedirectStrategy錯誤occured-誤差(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 

回答

0

RedirectStrategy4.1介紹現在已被棄用。所以當你包含4.1罐子setRedirectStrategy工作,但與4.2.3它沒有。

在這種情況下,你不能覆蓋系統(Android的)從這裏implementation.So我會建議你因此請參閱問題No. 1No. 2No. 3

+0

我檢查它,但它建議再次導入「org.apache.http.impl.client.LaxRedirectStrategy」。 – 2014-09-10 21:21:09

+0

錯誤:「進口org.apache.http.impl.client.DefaultRedirectStrategy.LaxRedirectStrategy不能得到解決」 – 2014-09-10 21:28:46

+0

遺憾地說,'setRedirectStrategy'之後4.1.See我的編輯答案棄用。 – 2014-09-10 22:22:15

相關問題