【发布时间】:2016-08-15 07:09:13
【问题描述】:
我正在尝试像过去在 Android 中那样使用 HttpPost。我意识到它已从最近的 Android 版本中删除。按照类似 StackOverflow 问题的解决方案,我将其添加到我的 Gradle 依赖项中:
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
在抱怨没有错误的 Gradle 同步之后,我仍然无法导入 HttpPost 程序。其实org.apache.http.client.methods这个包根本解析不出来。
我还尝试了 Apache HttpClient 网站的建议,即在我的 Gradle 依赖项中使用它:
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
再一次,同步正常,这一次包解决了,但不是 HttpPost 程序。
如有任何建议,我将不胜感激。
【问题讨论】: