[aerogear-dev] Android targetSDK and HTTP stack

Douglas Campos qmx at qmx.me
Tue Oct 30 13:57:21 EDT 2012


We discussed this before, there's a JIRA for that already: https://issues.jboss.org/browse/AEROGEAR-564

On Oct 30, 2012, at 1:43 PM, Marko Strukelj wrote:

> As we are leaning towards Level 10 as our targetSDK for Aerogear 1.0.0
> we should consider current usage of HttpClient.
> 
> As Summers pointed out in #aerogear IRC, Google has deprecated the
> platform HttpClient library, and stopped patching it.
> 
> Apache HTTP Client had been a lesser evil before, but has been
> deprecated with Gingerbread (Level 9 API), and
> java.net.HttpURLConnection has been bugfixed in later versions and
> made the preferred choice [1].
> 
> The JavaDoc in one of google-http-java-client library classes sums it
> up nicely [2].
> 
> 
> We are currently using HttpClient in aerogear-android.
> 
> To be future proof we should therefore move to
> java.net.HttpURLConnection. That API is one of those awkward early
> java APIs that isn't very nice to use. The big sore spot from
> backwards compatibility point of view is that HttpURLConnection had
> some ugly bugs in previous versions.
> 
> Google for their part is developing google-http-java-client library
> mentioned above - it's a wrapper library that checks current runtime
> environment, and uses HttpClient underneath when API Level is less
> than 9, otherwise it uses HttpURLConnection.
> 
> I haven't played enough with google-http-java-client to say we should
> use it. It comes with quite some dependencies, but those seem like
> optional, and it's possible that with the extent of functionality that
> we require the whole lib after proguard treatment can be squeezed to a
> really small size. But as I said, I need to play with it some more.
> 
> Any thoughts welcome.
> 
> 
> [1] http://android-developers.blogspot.com/2011/09/androids-http-clients.html
> [2] https://code.google.com/p/google-http-java-client/source/browse/google-http-client-android/src/main/java/com/google/api/client/extensions/android/http/AndroidHttp.java
> 
> 
> - marko
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev

-- qmx




More information about the aerogear-dev mailing list