1

I'm currently building a Retrofit object as follows:

Retrofit retrofit = new Retrofit.Builder()
  .baseUrl(BASE_URL)
  .addConverterFactory(GsonConverterFactory.create(gson))
  .build();

I don't need to pass it a client, i.e. no need to deal with the internals.

Now I would like to set a timeout, but all the examples I found involve creating an okHttpClient and assigning it to the Retrofit object.

Does it mean that okHttp is the de-facto client used by the system in all the situations?

1 Answer 1

1

Does it mean that okHttp is the de-facto client used by the system in all the situations?

Yes. Retrofit uses OkHttp for its network I/O. For example, in the Retrofit documentation, they mention in the section on R8/Proguard:

You might also need rules for OkHttp and Okio which are dependencies of this library

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.