with OkHttp we can make HTTP request then get response from server
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(url)
.build();
Response response = client.newCall(request).execute();
then with Gson lib convert response to object we need.
this is from Square/OkHttp doc:
Its request/response API is designed with fluent builders and immutability. It supports both synchronous blocking calls and async calls with callbacks
I read from stackOverFlow
Retrofit uses OkHTTP automatically if available
.
So my question is what is exactly Retrofit for?
what Retrofit can do that OkHttp can not?!
I think OkHttp and Gson solve request API problem, so what problem Retrofit solve for us?