Reputation: 223
I am getting cannot resolve symbol 'Header' when I am trying to use AsyncHttpClient.
AsyncHttpClient client = new AsyncHttpClient();
client.post(uploadWebsite, requestParams, new JsonHttpResponseHandler()
{
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response)
{
}
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse)
{
super.onFailure(statusCode, headers, throwable, errorResponse);
Toast.makeText(OZI_Wishlist.this, "Unable to connect to server. Check your network !!", Toast.LENGTH_SHORT).show();
}
});
Can somebody tell me what is wrong?
Thanks!
Upvotes: 1
Views: 2226
Reputation: 49460
cz.msebera.android
libraryAdd it to build.gradle file:
dependencies {
compile 'com.loopj.android:android-async-http:1.4.9'
}
Rebuild/sync and then import to java class:
import cz.msebera.android.httpclient.*;
Upvotes: 0
Reputation: 11464
Please add below dependency in your gradle file.
compile 'org.apache.httpcomponents:httpcore:4.4.1'
Because Header[]
is part of HttpCore not AsyncHttpClient library..!!
Upvotes: 4