AsyncHttpClient 的使用问题 Header 报错

GitHub:https://github.com/scruffyfox/AsyncHttpClient

AsyncHttpClient 的版本在1.4.9及以上的版本移除了 httpclient ,所以在使用时会报cz.msebera.android.httpclient.Header[] 找不到的错误,主要是因为cz.msebera.android.httpclient没导入
解决方法:
在项目的buildgradle文件中添加

compile 'cz.msebera.android:httpclient:4.3.6'

添加之后重新build就可以了
但是有可能会出现下面的错误警告

Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

只需将上面的compile修改为implementation即可。

其他解决方法:
网上现在cz.msebera.android.httpclient的jar包,导入项目即可
http://mvnrepository.com/artifact/cz.msebera.android/httpclient
该链接有多个版本可供选择

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章