问题描述
正如我们已经知道,的Apache HTTP客户端
中删除 API 23
As we have known that Apache HTTP Client
removed in API 23
不过,排球
库目前仍使用阿帕奇
的库如
However, Volley
library currently still uses Apache
's library such as
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.StatusLine;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.impl.cookie.DateUtils;
和我已经测试了2个项目:一是与 compileSdkVersion 22
,其他与 compileSdkVersion 23
,得到了2截屏
And I have tested 2 projects: one with compileSdkVersion 22
, the other with compileSdkVersion 23
, got 2 screenshots:
compileSdkVersion 22
compileSdkVersion 23
我有2个问题:
- 当然,用排枪API23项目仍然成功运行。不过,我不明白他们如何使用
阿帕奇
的库在运行时,做自己发现API22或更低呢? - 此外,我不知道在不久的将来,将凌空待升级不再使用
阿帕奇
的图书馆吗?如果没有,我目前的项目仍然工作在未来,当阿帕奇
的库完全去除,而不是支持?
- Of course, API23 projects using Volley still work successfully.However, I don't understand how they use the
Apache
's library at runtime, do theyfind in API22 or lower instead? - Moreover, I wonder if in the near future, will Volley be upgraded sothat no longer uses
Apache
's library? If not, will my current projects still work in the future whenApache
's library completely removed and not supported?
也许,我的英语也不是那么清楚,但是,希望你明白我的问题。
Perhaps my English is not so clear, however, hope that you understand my question.
任何解释,将AP preciated。
Any explanation will be appreciated.
更新:
从@随机的意见,我创建了使用谷歌的官方排球库(我的意思是 git的克隆https://android.googlesource.com/platform/frameworks/volley如谷歌建议这里),而不是使用,
编译com.mcxiaoke.volley:库:1.0.17
在 build.gradle
文件。是的,建设项目时,有错误与不足的Apache库。如记录必须添加 useLibraryorg.apache.http.legacy
到 build.gradle
文件。
From @random's comments, I created a new API23 project using Google's official Volley library (I mean by
git clone https://android.googlesource.com/platform/frameworks/volley
as Google suggested here), instead of using compile 'com.mcxiaoke.volley:library:1.0.17'
in build.gradle
file. Yes, got errors with lack of Apache library when building project. Must add useLibrary 'org.apache.http.legacy'
into build.gradle
file as documented.
2日更新:
我刚刚定制的谷歌的凌空(在我的项目模块)删除的Apache库。请访问我的GitHub示例项目供您参考。但是,请注意,它并没有被完全用于所有的情况下进行测试,而我只测试了02简单的情况:
GET
和 POST
我的Web服务请求是的ASP.NET Web API
。
I have just customized Google's volley (as a module in my project) removing Apache library. Please go to my GitHub sample project for your reference. However, please note that it has not been fully tested for all cases, and I have tested only 02 simple cases:
GET
and POST
requests with my web service that is ASP.NET Web API
.
推荐答案
这似乎出现了与Android的M.凌空库相当混乱的bug已经被申请,并承认谷歌。
It seems there has been quite a mess with the Volley library in Android M. A bug has already been filed for it and acknowledged by google.
https://开头code.google.com / P / Android的开发技术preVIEW /问题/详细信息?ID = 3013
您应该星和跟踪它的任何进一步的更新
You should star and track it for any further updates
更新
关于你的第一个问题,你没有得到一个错误,缺失
阿帕奇
文件,因为你正在使用的库仍然编译使用API 22
Regarding your first question, you don't get an error for missing
apache
files because the library that you're using is still compiled using API 22
ANDROID_BUILD_TARGET_SDK_VERSION=22
ANDROID_BUILD_TOOLS_VERSION=22.0.1
ANDROID_BUILD_SDK_VERSION=22
https://github.com/mcxiaoke/android-volley/ BLOB /主/ gradle.properties
另外,请查阅此悬而未决的问题从库
这篇关于的Apache HTTP从API23删除客户机,将那些对排球的影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!