OkHttp VS Retrofit

Compare OkHttp vs Retrofit and see what are their differences.

OkHttp

Square’s meticulous HTTP client for the JVM, Android, and GraalVM. (by square)

Retrofit

A type-safe HTTP client for Android and the JVM (by square)
Our great sponsors
  • Appwrite - The Open Source Firebase alternative introduces iOS support
  • InfluxDB - Access the most powerful time series database as a service
  • SaaSHub - Software Alternatives and Reviews
OkHttp Retrofit
37 41
43,733 41,332
0.3% 0.4%
9.1 3.3
3 days ago 6 days ago
Kotlin Java
Apache License 2.0 Apache License 2.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

OkHttp

Posts with mentions or reviews of OkHttp. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-03-06.
  • What stack to use for app with functionality like event calendar?
    2 projects | reddit.com/r/androiddev | 6 Mar 2023
    Retrofit in combination with OkHttp for fetching data from server (which hopefully already exists)
  • Generate Kotlin client for a complex web API
    7 projects | dev.to | 9 Feb 2023
  • Modern Android Development in 2023
    7 projects | dev.to | 23 Jan 2023
    OkHttp
  • Is it acceptable to use mock servers, like Postman, for testing in Android?
    3 projects | reddit.com/r/androiddev | 6 Sep 2022
    Being more familiar with Android development only, I mainly use https://github.com/square/okhttp/tree/master/mockwebserver
  • Best libraries for Android Developers
    19 projects | dev.to | 15 Jul 2022
    Retrofit is the best library that lets you connect to HTTP-based API services from your Android applications. It leverages the OkHttp library’s core functionality, adding a bunch of features to it while eliminating the boilerplate code.
  • How to use Cronet Engine for API calls? Any simple repo for it to understand?
    2 projects | reddit.com/r/androiddev | 30 Jun 2022
    Use Retrofit or anything else that builds on OkHttp. If you do end up needing some features that Cronet supports but OkHttp doesn't (such as HTTP/3), just write an interceptor or use google/cronet-transport-for-okhttp.
  • IPv6 Support on Android
    2 projects | reddit.com/r/RedditEng | 31 May 2022
    Even as of 2022, there are networks out there that have broken/misconfigured IPv6, and there most likely always will be. Some wireless carriers and ISPs support it, but in some cases, people have old or improperly-configured routers and devices. Patchy IPv6 support is less of a problem on iOS and the web these days since those clients have support for dynamically falling back on IPv4 when IPv6 fails. After more research, we realized that Android didn’t have this “dual-stack” IP support, and neither did our preferred networking library, OkHttp. This explained why the content-loading issues only surfaced on Android, and why it took some additional digging to uncover the root cause.
    2 projects | reddit.com/r/RedditEng | 31 May 2022
    Working with the reddit infrastructure team, we did more testing and built high confidence that this last IPv6 theory was indeed the cause of users’ content-loading problems. We assessed our usage of OkHttp and checked if there were any upcoming plans to improve support. OkHttp did have an open ask for “Happy Eyeballs” #506, but no known plans to implement it. Out of due diligence, we also assessed other network libraries– but knew that moving off OkHttp would be a radical change, indeed. We read the RFC 8305, “Happy Eyeballs algorithm for dual-stack IPv4/IPv6”, and thought “wow, we don’t want to implement this ourselves.” And as we were studying that open OkHttp issue and thinking “If only they would…”
  • App Flow of an Android App?
    2 projects | reddit.com/r/androiddev | 23 May 2022
    Your app would request data from the backend inside it's domain layer. As the other commenter mentioned, Retrofit is a commonly used library for interfacing with REST APIs, which is built on top of OkHttp (a more generic HTTP client).
  • Watery : A water delivery solution android app
    3 projects | dev.to | 1 May 2022
    OkHttp

Retrofit

Posts with mentions or reviews of Retrofit. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-03-06.

What are some alternatives?

When comparing OkHttp and Retrofit you can also consider the following projects:

unirest-java - Unirest in Java: Simplified, lightweight HTTP client library.

Feign - Feign makes writing java http clients easier

Async Http Client - Asynchronous Http and WebSocket Client library for Java

Netty - Netty project - an event-driven asynchronous network application framework

Android Volley

android-async-http - This project under develop

Jersey - Eclipse Jersey Project - Read our Wiki:

RESTEasy - An Implementation of the Jakarta RESTful Web Services Specification

gRPC - The Java gRPC implementation. HTTP/2 based RPC