I'm testing Volley's HurlStack in Android M Developer Preview.
After I change compileSdkVersion
from 22
to 'android-MNC'
, all classes from org.apache.http are not compiled:
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.StatusLine;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicHttpResponse;
import org.apache.http.message.BasicStatusLine;
How can I modify my code to solve this problem?
I know there're some changes related to Apache HTTP client, but it still doesn't work when I follow the steps to add useLibrary 'org.apache.http.legacy'
in gradle.
Reference: HurlStack.java AOSP
The official “Behaviour Changes” document states that the Apache HTTP client is removed in Android M — not deprecated, but removed. Personally I highly suggest switching to OkHttp which actually is used as a HttpURLConnection
engine since KitKat, by using a dependency you get all fresh goodies from Square team directly.