Retrofit Slower response time in real android devices when compared to emulator and web

In retrofit, it does following work:

  1. Build up the Retrofit class.
  2. Impl the Interface with DynamicProxy
  3. Parse and create the Http request accourding to the annotations.
  4. Send and receive HTTP(socket) IOs with OkHttp in ThreadPool(In Android, Network can't be done on main thread).
  5. Deserialize your Http body with some lib (eg. gson).
  6. update UI in callback.

In your phone, I think 1,2,3 won't be necessary, they can even be done on main thread or cached. In my device (Qcom615, 2Gram), it will take less than one ms.

So you need to debug with your network.

fix problem one by one:

  1. Is your server use HTTPS or no-cacahe or no-gzip? Logging your data and tell your server's partner, they can give you some advice.
  2. try faster lib for converters.
  3. improve your view's code(eg. void redraw/relayout, void a long-time job in main thread).

Slow response has nothing to do you with your phone it may be due to several reasons. Some noticeable reason i know are mentioned below.

1) Internet connection on your device may be slower comparatively to your emulator which uses network connection of your machine (wifi or lan connected).

2) There are multiple applications using internet on your device in background. Check application running background process and stop them.

To ensure test your internet speed on your device using speedtest.net. Hope it helps you .


When I run my app in the debugger, it was unusable slow. When I run it outside the debugger, it performs better.

So conclusion is that Mentioned problem was not related with tool and libraries that I was using . Issue was with USB debugging .

Since I was new To android development I was not aware of the performance of APP in USB debugging mode .