今天在Android Studio上使用Android-async-http框架时遇到了各种问题,归纳如下:
1.采用了最新的编译版本android 6.0,但是发现在运行时,之前程序里引用的org.apache.http.Header类找不到了。通过查找发现: Android 6.0 release removes support for the Apache HTTP client. 也就是说Http Client在android 6.0 被移除了,那怎么使用呢?
解决方法:引入org.apache.http.legacy.jar和httpclient-4.3.6.jar
例子:
public void onSuccess(int statusCode,
cz.msebera.android.httpclient.Header[] headers, JSONObject response) {
System.out.println(response.toString());
}
红色字体需要特别注意