I have to build an android application that accesses a php script that echoes json. I migrated to android studio,targeted andoid sdk 22 (5.0),had a minimum sdk of 8(Froyo) and built the project.
The snag occurred where my past code that i used on eclipse to launch "httppost" requests where not working.
The logcat showed an "unknown host exception" for the urls that where passed as strings.
When i changed from "defaulthttpclient" to "httpurlconnection" it worked,but the connection was too slow. (On android 2.2)
I read about the "Retrofit" api as a good library for fast http requests, but i read two conflicting reports:
The minimum sdk for retrofit is android 2.3
And then
Retrofit uses httpurlconnection on android 2.3+ and httpclient on androd 2.2
This has me a bit confused. So the real question is
Can retrofit handle my http requests on an android 2.2 phone?
Yes, but you have to run retrofit with pre2.0 okhttp, urlconnection or apache client.
Latest versions of the okhttp require Java7 or android 2.3+
https://square.github.io/retrofit/#download
https://github.com/square/retrofit/issues/826
https://github.com/square/okhttp/issues/528#issuecomment-96622594