conn.addRequestProperty(entity.getContentType().getName(), entity.getContentType().getValue());
It crashes on samsung device running operating system version 4.1. While on Marshmallow Nexus 6 device, it works perfectly fine. What is the problem?
Gradle file
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
I have in my libs folder httpclient-4.3.3.jar httpclient-cache-4.3.3.jar httpcore-4.3.2.jar httpmime-4.3.3.jar
Apache http client was removed since marshmallow.
See here Apache HTTP Client Removal
Solution (about embed client at all):
android {
useLibrary 'org.apache.http.legacy'
}
UPDATED: About the particular problem see related post
Btw, in my project I can't add apache http client as a library, because of package name conflict with embed cliend. I have to use this or as described here