I'm looking for an alternative HTTP client library than what is already included in the SDK. I haven't been able to find any. Does anyone know of any? It doesn't have to be open source.
-
Maybe it would help if you explained why the build in library is not suitable for your requirements. That way people may be able to suggest a library which will meet them. – Mark Allison Jun 14 '11 at 09:14
-
yeah exactly. the only time you have to use another httpClient is if you are doing multipart uploads (here you can add the mime libs and still use the android http client), or if there are any bugs in the current http Client lib. the alternative to using the http client is the more basic implementation and that is the url connection. the http client just make's working with connections easier than url connection. – DArkO Jun 14 '11 at 09:20
-
also by adding more libraries which you don't really need is just increasing your app size. – DArkO Jun 14 '11 at 09:22
-
I don't wish to cover the reasons why I need the library. Those reasons have been covered in many other posts. I am only interested at this point in finding an alternative library. – Johann Jun 14 '11 at 09:30
3 Answers
Many of the issues with Android's built in HttpClient are related issues that have been resolved in HttpClient 4.1. Dirk Boye has created a script to convert the HttpClient 4.1 sources into an Android friendly package. You can find some prepackaged jar files and his script here: https://code.google.com/p/httpclientandroidlib/

- 246
- 2
- 4
-
Where is the documentation of the library...? I have found that some classes are missing. – Ratul Doley Jun 23 '16 at 15:47
You have different options to manage networking in Android:
OkHttp (needs Okio) + Volley + Gson: is a common REST solution for JSON based APIs. You can use each of these tools separately, so for example if you don't need JSON serialization/deserialization you can just use OkHttp + Volley (where OkHttp is the Http client and Volley is a REST library/helper that offers an easy way to load images as well). If you just want an alternative Http client you can use OkHttp(+Okio) which is the best one or among them right now. OkHttp needs Okio(that you can use as well separately) and is a library that complements java.io and java.nio to make it much easier to access, store, and process your data. You can find more information about this solution here..
OkHttp (needs Okio) + Retrofit + Moshi + Picasso. This option is pretty much equivalent to the previous one. Retrofit is comparable to Volley, Moshi to Gson and Picasso is on image loading department. All of this stuff was mainly developed by the same guys and all tied together works like a charm. More on that here.
ION is a very good library that tries to deal with a lot of stuff mention in the options 1 and 2 (Http client, REST helper, uses Gson as well and load images). Better check this out.
Android Async Http: I haven't tried and don't have any information about it, but looks like might be worth taking a look.
I'd say the option 1 is being replace by the option 2. The option 3 has a lot of fans and is developed basically by one (awesome) guy, but offers a LOT of things that you might be not using. That's the reason the Square guys (guys behind option 2) have split everything in 5 different libraries. I can't say much about the option 4. I might be checking it out soon.
Notable mention is Glide, that is (maybe) the best image loading library today developed by the (Google acquired) Bumptech guys.
A guy working on Okio/OkHttp was working in Google on the SDK http client, worked on Gson and is working on Moshi. That's the reason I am more inclined for the option 2 nowadays, people use to do better stuff than previously, or at least not worse.

- 14,089
- 2
- 50
- 43
-
OkHttp and Volley have no the same goal. Volley is a REST helper library while OkHttp is an Http client. In fact OkHttp + Volley are usually tied together as you can se here https://goo.gl/nl2DfN – Sotti Jul 16 '15 at 11:12