LoopJ Header []错误

Ton*_*pps 2 android loopj android-studio

我正在尝试使用,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) {

            }


        });
Run Code Online (Sandbox Code Playgroud)

错误的图像]

den*_*lor 5

在您的gradle文件中,您还应该添加dependency:

compile 'org.apache.httpcomponents:httpcore:4.4.1'
Run Code Online (Sandbox Code Playgroud)

Header[]是部分HttpCore没有AsyncHttpClient图书馆.