Android AsyncHttpClient unable to find character class Title

I am trying to create an asynchronous call to relax in Android using the com.loopj.android.http.AsyncHttpClient library , however I cannot implement the overridden AsyncHttpResponseHandler methods because Android Studio cannot find the appropriate import for the Header class

How can I solve the problem with a header class not recognized by the Android Studio IDE?

  public void onSuccess(int statusCode, Header[] headers, byte[] response) { // called when response HTTP status is "200 OK" } 

I see that if I click and click on the title, I get the following message, but I don’t know how to select one of several options in this menu (moving the mouse rejects it)

enter image description here

+5
source share
3 answers

When I typed this question, I found the answer, I hope it helps you:

Press Option + enter on Mac when this popup is visible, then select import org.apache.http.Header; in the dropdown menu:

enter image description here

+5
source

Alex's answer is no longer valid since org.Apache.http is deprecated from API level 22.

Please replace all org.apache.http links with cz.msebera.android.httpclient and use the loop version 1.4.9, which includes the library.

For those using gradle, change your dependencies in the build.gradle file

 dependencies { compile 'com.loopj.android:android-async-http:1.4.9' } 

Restore and then import cz.msebera.android.httpclient to use the header.

+15
source

For those using gradle, change your dependencies in the build.gradle file

dependencies { compile 'com.loopj.android:android-async-http:1.4.9' compile 'cz.msebera.android:httpclient:4.4.1.2' }

On Ubuntu, use ALT + Enter in the [] header, as described above for Mac

Which also changed the import that I guessed in android. * at httpclient.header

 import cz.msebera.android.*; import cz.msebera.android.httpclient.Header; 
0
source

All Articles