AsyncHttpResponseHandler类使用报错,找不到org.apache.http.Header

AsyncHttpResponseHandler使用过程中报错,无法引入org.apache.http.Header
在使用ANdroidStudio时,采用高编译版本版本android6.0,报错,引用的org.apache.http.Header类找不到。

Android 6.0 release removes support for the Apache HTTP client.
说Apache Http Client在android 6.0中被移除(废弃)。
解决办法:
在build.gradle中配置如下方案即可解决:

android {
    useLibrary 'org.apache.http.legacy'
    ......
}

如本人配置如下图:
org.apache.http.legacy使用配置

猜你喜欢

转载自blog.csdn.net/fengshow0/article/details/80734268