seato
seato

Reputation: 2121

How to upgrade Apache HttpClient Versions on Android

I've added HttpClient 4.3.3 for android to my build.gradle file as described by Apache, but my app hasn't changed in size. Because of this I'm pretty sure that, while my IDE shows httpclient-android-4.3.3 as an External Library, it's not actually being included and used by my app.

I've tried to verify the version of http client according to this post, but VersionInfo.loadVersionInfo() keeps returning null.

My questions boil down to:

  1. How do I verify the version of Apache HttpClient that I'm using?
  2. How do I make it so that my app uses the version I've specified in Gradle? Am I supposed to exclude the Android HttpClient in my gradle build?

Upvotes: 6

Views: 1628

Answers (1)

Victor Basso
Victor Basso

Reputation: 5796

Android comes with a fork of apache HttpClient 4.0 built in and gradle will ignore when you try to import a newer version. (It gives me a warning: "Dependency org.apache.httpcomponents:httpclient:4.4.1 is ignored for debug as it may be conflicting with the internal version provided by Android.")

There's an official workaround. It's a fork of httpclient with different package names and other compatibility changes. You can find it in maven repository (or look for "httpclient-android").

Upvotes: 3

Related Questions