Search code examples
androidretrofitokhttpdagger-2retrofit2

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


I am making a restful API call from Android device to populate a list view .

I have used swagger codegen to generate my retrofit client .

Dagger 2 for dependency injection

Device : Asus Zenfone 5

I have tried to make call from postman, web and also in emulator (genymotion) it is much faster compared to a real device.

And interesting thing is that every time when I restart my phone for two to three request the response time is normal and after that getting slower.

I read some blog regarding gzip compression in okHTTP and try to implement that but no effect.

It would be really helpful if someone can help me to figure out the issue.


Solution

  • 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 .