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!
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..!!