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;
And I have tested 2 projects: one with compileSdkVersion 22
, the other with compileSdkVersion 23
, got 2 screenshots:
compileSdkVersion 22
compileSdkVersion 23
I have 2 questions:
- Of course, API23 projects using Volley still work successfully.
However, I don't understand how they use the
Apache
's library at runtime, do they find in API22 or lower instead? - Moreover, I wonder if in the near future, will Volley be upgraded so
that 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.
Any explanation will be appreciated.
UPDATE:
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.
2nd UPDATE:
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
.
useLibrary 'org.apach.http.legacy'
flag is a workaround to keep legacy code when it was intentionally removed. I'd expect Volley to either overhaul the entire code to remove the apache components, or declare that this library will not be developed much further. Things are pretty vague at the moment. – Kocher