NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Maven Central · #582 by repository stars
A Retrofit CallAdapter for RxJava 2's stream types.
Last release 1 years ago
15 May 2025
Ships unpredictably
gaps range from 1 weeks to 3.8 years
Nearly every release is documented
notes for 20 of 20 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
20 releases · first in 2017
Upgrade to OkHttp 4.12 (from 3.14).
Changed
Upgrade to OkHttp 4.12 (from 3.14).
This is the version of OkHttp that is written in Kotlin, and as a result Retrofit now has a transitive Kotlin dependency. However, this is also the supported version of OkHttp whereas the previous version was out of support for nearly 4 years.
Note: The 3.x versions of Retrofit maintain forward binary-compatibility with the 2.x versions.
This means libraries compiled against 2.x can still be used with the 3.x versions.
First-party converters now support deferring serialization to happen when the request body is written (i.e., during HTTP execution) rather than when t
New
First-party converters now support deferring serialization to happen when the request body is written (i.e., during HTTP execution) rather than when the HTTP request is created. In some cases this moves conversion from a calling thread to a background thread, such as in the case when using Call.enqueue directly.
The following converters support this feature through a new withStreaming() factory method:
Fixed
@Tag now work by storing the value boxed with the boxed class as the key.One column per quarter.
The built-in OptionalConverterFactory is now public to allow installing it before other converters which consume all types (e.g., Moshi, Gson, Jackson
New
OptionalConverterFactory is now public to allow installing it before other converters which consume all types (e.g., Moshi, Gson, Jackson, etc.).Fixed
ClassCastException.Support using Unit as a response type. This can be used for non-body HTTP methods like HEAD or body-containing HTTP methods like GET where the body wi
New
Support using Unit as a response type. This can be used for non-body HTTP methods like HEAD or body-containing HTTP methods like GET where the body will be discarded without deserialization.
kotlinx.serialization converter!
This was imported from github.com/JakeWharton/retrofit2-kotlinx-serialization-converter/ and remains unchanged from its 1.0.0 release.
The Maven coordinates are com.squareup.retrofit2:converter-kotlinx-serialization.
JAXB 3 converter!
The Maven coordinates are com.squareup.retrofit2:converter-jaxb3.
@Header, @Headers, and @HeaderMap can now set non-ASCII values through the allowUnsafeNonAsciiValues annotation property. These are not technically compliant with the HTTP specification, but are often supported or required by services.
Publish a BOM of all modules. The Maven coordinates are com.squareup.retrofit2:retrofit-bom.
Invocation now exposes the service Class<?> and the instance on which the method was invoked. This disambiguates the source when service inheritence is used.
A response type keeper annotation processor is now available for generating shrinker rules for all referenced types in your service interface. In some cases, it's impossible for static shrinker rules to keep the entirety of what Retrofit needs at runtime. This annotation processor generates those additional rules. For more info see its README.
Changed
Call, Response, etc.) which are used via reflection at runtime.Retrofit.create function now has a non-null lower bound. Even if you specified a nullable type before this function would never return null.Throwable subtypes (not just Exception subtypes) to avoid Java's UndeclaredThrowableException when thrown synchronously.suspend fun functions that return Call<Body>. These are never correct, and should declare a return type of Body directly.create(ObjectMapper, MediaType) overload to supply the value of the Content-Type header for your format.Fixed
The Maven coordinates are com.squareup.retrofit2:adapter-rxjava3.
New: RxJava 3 adapter!
The Maven coordinates are com.squareup.retrofit2:adapter-rxjava3.
Unlike the RxJava 1 and RxJava 2 adapters, the RxJava 3 adapter's create() method will produce asynchronous HTTP requests by default. For synchronous requests use createSynchronous() and for synchronous on a scheduler use createWithScheduler(..).
Fix: Detect running on the Android platform by using system property rather than the presence of classes. This ensures that even when you're running o
Fix: Do not access MethodHandles.Lookup on Android API 24 and 25. The class is only available on Android API 26 and higher.
MethodHandles.Lookup on Android API 24 and 25. The class is only available
on Android API 26 and higher.New: Add Call.timeout() which returns the okio.Timeout of the full call.
Call.timeout() which returns the okio.Timeout of the full call.Call.awaitResponse() to accept a nullable response type.Fix: Update to OkHttp 3.14.7 for compatibility with Android R (API 30).
Fix: Support 'suspend' functions in services interfaces when using 'retrofit-mock' artifact.
This release changes the minimum requirements to Java 8+ or Android 5+. See this blog post for more information on the change.
This release changes the minimum requirements to Java 8+ or Android 5+. See this blog post for more information on the change.
Response.error.Fix: Support 'suspend' functions in services interfaces when using 'retrofit-mock' artifact.
Fix: Change mechanism for avoiding UndeclaredThrowableException in rare cases from using yield an explicit dispatch which ensures that it will work ev
UndeclaredThrowableException in rare cases from using yield
an explicit dispatch which ensures that it will work even on dispatchers which do not support yielding.Fix: Avoid IOExceptions being wrapped in UndeclaredThrowableException in rare cases when using Response<..> as a return type for Kotlin 'suspend' func
IOExceptions being wrapped in UndeclaredThrowableException in rare cases when using
Response<..> as a return type for Kotlin 'suspend' functions.Fix: Avoid IOExceptions being wrapped in UndeclaredThrowableException in rare cases.
IOExceptions being wrapped in UndeclaredThrowableException in rare cases.ResponseBody for responses created by Response.error.New: Support suspend modifier on functions for Kotlin! This allows you to express the asynchrony of HTTP requests in an idiomatic fashion for the lang
New: Support suspend modifier on functions for Kotlin! This allows you to express the asynchrony of HTTP requests
in an idiomatic fashion for the language.
@GET("users/{id}")
suspend fun user(@Path("id") id: Long): User
Behind the scenes this behaves as if defined as fun user(...): Call<User> and then invoked with Call.enqueue.
You can also return Response<User> for access to the response metadata.
Currently this integration only supports non-null response body types. Follow issue 3075 for nullable type support.
New: @Tag parameter annotation for setting tags on the underlying OkHttp Request object. These can be read
in CallAdapters or OkHttp Interceptors for tracing, analytics, varying behavior, and more.
New: @SkipCallbackExecutor method annotation will result in your Call invoking its Callback on the
background thread on which the HTTP call was made.
New: Support OkHttp's Headers type for @HeaderMap parameters.
New: Add Retrofit.Builder.baseUrl(URL) overload.
Fix: Add embedded R8/ProGuard rule which retains Retrofit interfaces (while still allowing obfuscation). This is needed because R8 running in 'full mode' (i.e., not in ProGuard-compatibility mode) will see that there are no subtypes of these interfaces and rewrite any code which references instances to null.
Fix: Mark HttpException.response() as @Nullable as serializing the exception does not retain this instance.
Fix: Fatal errors (such as stack overflows, out of memory, etc.) now propagate to the OkHttp Dispatcher thread
on which they are running.
Fix: Ensure JAX-B converter closes the response body when an exception is thrown during deserialization.
Fix: Ignore static methods when performing eager validation of interface methods.
Fix: Ensure that calling source() twice on the ResponseBody passed to a Converter always returns the same
instance. Prior to the fix, intermediate buffering would cause response data to be lost.
Support is now built-in and those types and their artifacts are marked as deprecated.
Unit type. This behaves the same as Java's Void where the body
content is ignored and immediately discarded.Optional and CompletableFuture types. Previously the 'converter-java8'
and 'adapter-java8' dependencies were needed and explicitly adding Java8OptionalConverterFactory and/or
Java8CallAdapterFactory to your Retrofit.Builder in order to use these types. Support is now built-in and
those types and their artifacts are marked as deprecated.Invocation class provides a reference to the invoked method and argument list as a tag on the
underlying OkHttp Call. This can be accessed from an OkHttp interceptor for things like logging, analytics,
or metrics aggregation.Retrofit which allows you call create passing the interface type only as
a generic parameter (e.g., retrofit.create<MyService>()).Response.success overload which allows specifying a custom 2xx status code.Calls.failure overload which allows passing any Throwable subtype.onSubscribe.RxJavaPlugins assembly hook when creating an RxJava 2 type.Optional converters delegate properly. This ensures that converters
registered prior to the optional converter can be used for deserializing the body type.@Path values from participating in path-traversal. This ensures untrusted input passed as
a path value cannot cause you to make a request to an un-intended relative URL.RuntimeException
or IOException when it fails.@QueryName or @QueryMap precedes a @Url parameter.New: Converter for JAXB replaces the now-deprecated converter for Simple XML Framework.
Retrofit.Builder exposes mutable lists of the added converter and call adapter factories.Future.Errors from callbacks (usually OutOfMemoryError).Call cancelation with RxJava unsubscription/disposal. Prior to
this change, canceling of a Call would prevent a cancelation exception from propagating down
the Rx stream.Retrofit now uses `@Nullable` to annotate all possibly-null values. We've added a compile-time dependency on the JSR 305 annotations. This is a [provi
Retrofit now uses @Nullable to annotate all possibly-null values. We've
added a compile-time dependency on the JSR 305 annotations. This is a
[provided][maven_provided] dependency and does not need to be included in
your build configuration, .jar file, or .apk. We use
@ParametersAreNonnullByDefault and all parameters and return types are
never null unless explicitly annotated @Nullable.
Warning: this release is source-incompatible for Kotlin users. Nullability was previously ambiguous and lenient but now the compiler will enforce strict null checks.
New: Converters added for Java 8's and Guava's Optional which wrap a potentially-nullable
response body. These converters still rely on normal serialization library converters for parsing
the response bytes into an object.
New: String converters that return null for an @Query or @Field parameter are now skipped.
New: The mock module's NetworkBehavior now throws a custom subclass of IOException to more
clearly indicate the exception's source.
RxJava 1.x converter updated to 1.3.0 which stabilizes the use of Completable.
Fix: Add explicit handling for OnCompleteFailedException, OnErrorFailedException, and
OnErrorNotImplementedException for RxJava 1.x to ensure they're correct delivered to the
plugins/hooks for handling.
Fix: NoSuchElementException thrown when unsubscribing from an RxJava 1.x Single.
HttpException has been moved into the main artifact and should be used instead of the versions embedded in each adapter (which have been deprecated).
@QueryName annotation allows creating a query parameter with no '=' separator or value.toString() implementations for Response and Result.createAsync() to RxJava 1.x call adapter factory which executes requests using
Call.enqueue() using the underlying HTTP client's asynchronous support.NetworkBehavior now allows setting an error percentage and returns HTTP errors when triggered.HttpException has been moved into the main artifact and should be used instead of the versions
embedded in each adapter (which have been deprecated).CallAdapter from the adapt method to the enclosing
class. This is a source-incompatible but binary-compatible change which is only relevant if you are
implementing your own CallAdapters.Call in Retrofit's Call.String type on non-body parameters. This allows user
converters to handle cases such as when annotating string parameters instead of them always using
the raw string.Your coding agent can read these notes before it upgrades. Set up the MCP server →