If you are compiling against Android 6.0 (SDK 23), you need to include org.apache.http.legacy library.
In Android Studio add
android {
useLibrary 'org.apache.http.legacy'
}
to build.gradle.
In Eclipse copy org.apache.http.legacy.jar
from AndroidSDK/platforms/android-23/optional
to libs folder.