Project Introduction

Marek Sebera edited this page May 2, 2016 · 2 revisions

## HttpClient for Android

This project represents an effort to provide an implementation of Apache HttpClient, which can be deployed on Google Android in parallel to the outdated version shipped with the platform while, due to alternative package name of this library, it's not using any of Android provided outdated classes, and project does support Android API 23+ where org.apache.http classes have been removed completely.

Background

Google Android 1.0 was released with a pre-BETA snapshot of Apache HttpClient. To coincide with the first Android release Apache HttpClient 4.0 APIs had to be frozen prematurely, while many of interfaces and internal structures were still not fully worked out. As Apache HttpClient 4.0 was maturing the project was expecting Google to incorporate the latest code improvements into their code tree. Unfortunately it did not happen. Version of Apache HttpClient shipped with Android has effectively become a fork. Eventually Google decided to discontinue further development of their fork while refusing to upgrade to the stock version of Apache HttpClient citing compatibility concerns as a reason for such decision. As a result those Android developers who would like to continue using Apache HttpClient APIs on Android cannot take advantage of newer features, performance improvements and bug fixes.

Apache HttpClient 4.X port for Android is intended to remedy the situation by providing releases compatible with Google Android.

Differences with the stock version of Apache HttpClient

  • Compiled against HttpClient 4.X APIs.
  • Commons Logging replaced with Android Logging.
  • Base64 implementation from Commons Codec replaced with Android Base64.

Compatibility notes

  • HttpClient port for Android is compiled against the official Android SDK v23 and is expected to be fully compatible with any code consuming HttpClient services through its interface (HttpClient) rather than the default implementation (DefaultHttpClient).
  • In your code you'll have to use classes from package cz.msebera.android.httpclient instead of org.apache.http
  • This library provides compatibility with Android SDK 23 and higher
  • You do not have to use useLibrary 'org.apache.http.legacy' statement, which was introduced for projects that didn't migrate from Android provided HttpClient classes

Download

HttpClient 4.X for Android is available from the Maven central and can be added to Gradle builds as the following dependency:

repositories {
    mavenCentral()
}

dependencies {
    // Latest version of 4.3 API is 4.3.6.1
    // Latest version of 4.4 API is 4.4.1.2
    // other versions and documentation can be found here: https://github.com/smarek/httpclient-android/releases
    compile group: 'cz.msebera.android' , name: 'httpclient' , version: '4.4.1.2'
}
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.