2

I am trying call an API by using loopj library.Because I want to totally avoid org.apache.http.legacy method for calling API.

So I add the dependency for the loopj and build the project

 compile 'com.loopj.android:android-async-http:1.4.9'

loopj is successfully build, but when i try to call Header for the AsyncHttpResponseHandler org.apache.http.Header[] headers is automatically import instead of cz.msebera.android.httpclient.Header

    AsyncHttpClient clientloop = new AsyncHttpClient();

     clientloop.get("http://www.google.com",new AsyncHttpResponseHandler() {
         @Override
         public void onSuccess(int i, org.apache.http.Header[] headers, byte[] bytes) {

         }

         @Override
         public void onFailure(int i, org.apache.http.Header[] headers, byte[] bytes, Throwable throwable) {

         }
     });

can anyone please help me to avoid the calling of org.apache.http

Binil Surendran
  • 2,524
  • 6
  • 35
  • 58

1 Answers1

3

Add this dependency in gradle compile 'cz.msebera.android:httpclient:4.3.6'

after that check the import on class, it should like this import cz.msebera.android.httpclient.Header;

Mochamad Taufik Hidayat
  • 1,264
  • 3
  • 21
  • 32