我正在尝试使用 LoopJ
但它在 Header[]
参数上给我一个错误,如下图所示。它说我需要导入 Header
包,但是当我这样做时,它在 FileAsyncHttpResponseHandler
上给我另一个错误。
AsyncHttpClient client = new AsyncHttpClient();
client.get("https://example.com/file.png", new FileAsyncHttpResponseHandler(/* Context */ this) {
@Override
public void onFailure(int i, Header[] headers, Throwable throwable, File file) {
}
@Override
public void onSuccess(int i, Header[] headers, File file) {
}
});
最佳答案
在你的 gradle
文件中,你还应该添加这个 dependency
:
compile 'org.apache.httpcomponents:httpcore:4.4.1'
Header[]
是 HttpCore
而非 AsyncHttpClient
库的一部分。
关于android - LoopJ Header[] 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34608506/