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
Behavior Changes: Apache HTTP Client Removal
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.
You can ignore these warns, because Volley is still compiled using API 22: https://github.com/mcxiaoke/android-volley/blob/master/gradle.properties
add these in proguard configuration: -dontwarn org.apache.http.** -dontwarn com.android.volley.toolbox.**
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With