我目前正在使用 HttpPost 和 HttpPut 将实体从我的移动应用程序发送到服务器。我正在使用 setEntity 将实体从数据库发送到服务器,它简单、直接并且运行良好,但它现在已从版本 23 的支持库中删除。 我发现的一些替代 HttpPost 和 HttpPut 的东西没有任何像 setEntity 这样的方法,重构会非常复杂。没有这样的方法还是我找不到?有什么建议么? 我尝试使用
添加回 Httpcompile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
但是没有用。
最佳答案
httpclient-android
是适用于 android 23+ 的 apache HttpClient
端口。您可以将它包含在 --
compile "cz.msebera.android:httpclient:4.4.1.1"
您还需要更改导入语句以使用新的包名称。
关于android - 在 android 上用一些 "setEntity"方法可以很好地替代 HttpPost 和 HttpPut 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34335553/