# retrofit

Published articles for retrofit.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Starting Android at Khan Academy

DevFeed: [Starting Android at Khan Academy](<https://devfeed.tech/articles/starting-android-at-khan-academy-27408.md>)

Original publisher: [Read original article](<http://engineering.khanacademy.org/posts/starting-android.htm>)

Author: Khan Academy

Published: 2016-02-29T23:00:00Z

Content type: article

Language: en

Sources: [Khan Academy](<https://devfeed.tech/sources/khan-academy.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [android-development](<https://devfeed.tech/topics/android-development.md>), [Development](<https://devfeed.tech/topics/development.md>), [Library](<https://devfeed.tech/topics/library.md>), [modules](<https://devfeed.tech/topics/modules.md>), [ci](<https://devfeed.tech/topics/ci.md>), [Mocking](<https://devfeed.tech/topics/mocking.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [development](<https://devfeed.tech/tags/development.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [libraries](<https://devfeed.tech/tags/libraries.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [mocking](<https://devfeed.tech/tags/mocking.md>), [module](<https://devfeed.tech/tags/module.md>), [modules](<https://devfeed.tech/tags/modules.md>), [news](<https://devfeed.tech/tags/news.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [picasso](<https://devfeed.tech/tags/picasso.md>), [play-store](<https://devfeed.tech/tags/play-store.md>), [pre-commit](<https://devfeed.tech/tags/pre-commit.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [test](<https://devfeed.tech/tags/test.md>), [tests](<https://devfeed.tech/tags/tests.md>)

### AI overview

Khan Academy describes its first Android app, launched in August 2015, and the engineering practices used to build it. The team adopted established Android and open-source libraries, separated Android-independent core code from the app module, and used fast JVM tests and continuous integration.

### Source excerpt

By Ben Komalo The journey of a thousand miles... In March, 2015--almost 1 year ago to the day--we ... Read more

## Deconstructing OkHttp

DevFeed: [Deconstructing OkHttp](<https://devfeed.tech/articles/deconstructing-okhttp-32252.md>)

Original publisher: [Read original article](<https://publicobject.com/2026/05/22/deconstructing-okhttp/>)

Author: Jesse Wilson

Published: 2026-05-22T12:00:00Z

Content type: article

Language: en

Sources: [Public Object](<https://devfeed.tech/sources/public-object.md>)

Topics: [Library](<https://devfeed.tech/topics/library.md>), [Network](<https://devfeed.tech/topics/network.md>), [Code](<https://devfeed.tech/topics/code.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [Cache](<https://devfeed.tech/topics/cache.md>), [certificates](<https://devfeed.tech/topics/certificates.md>)

Tags: [architecture](<https://devfeed.tech/tags/architecture.md>), [cache](<https://devfeed.tech/tags/cache.md>), [certificates](<https://devfeed.tech/tags/certificates.md>), [https](<https://devfeed.tech/tags/https.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [kotlinconf](<https://devfeed.tech/tags/kotlinconf.md>), [ktor](<https://devfeed.tech/tags/ktor.md>), [library](<https://devfeed.tech/tags/library.md>), [network](<https://devfeed.tech/tags/network.md>), [okhttp](<https://devfeed.tech/tags/okhttp.md>), [performance](<https://devfeed.tech/tags/performance.md>), [presentation](<https://devfeed.tech/tags/presentation.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

A KotlinConf talk examines OkHttp's implementation rather than its basic usage, covering interceptor-based architecture, connection lifecycles, cache state machines, URL decoders, HTTPS testing certificates, performance, and extension mechanisms.

### Source excerpt

I presented this at KotlinConf on May 22, 2026. Also available on slides, YouTube, and Speaker Deck. OkHttp is a popular library for making network calls. You might use it directly, or with Ktor, Retrofit, Coil, or gRPC. But this is not a talk on how to use OkHttp. Instead,

## Scalable API Response Handling Across Multi-Layered Architectures with Sandwich

DevFeed: [Scalable API Response Handling Across Multi-Layered Architectures with Sandwich](<https://devfeed.tech/articles/scalable-api-response-handling-across-multi-layered-architectures-with-sandwich-25924.md>)

Original publisher: [Read original article](<https://proandroiddev.com/scalable-api-response-handling-across-multi-layered-architectures-with-sandwich-39ab02ae8c90?source=rss-9bb203a4ab2e------2>)

Author: Jaewoong Eum

Published: 2026-02-08T06:25:14Z

Content type: tutorial

Language: en

Sources: [Stories by Jaewoong Eum on Medium](<https://devfeed.tech/sources/stories-by-jaewoong-eum-on-medium.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [API](<https://devfeed.tech/topics/api.md>), [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>), [Error Handling](<https://devfeed.tech/topics/error-handling.md>), [Network](<https://devfeed.tech/topics/network.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [code](<https://devfeed.tech/tags/code.md>), [communication](<https://devfeed.tech/tags/communication.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [error-handling](<https://devfeed.tech/tags/error-handling.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [flow](<https://devfeed.tech/tags/flow.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [mvi](<https://devfeed.tech/tags/mvi.md>), [mvvm](<https://devfeed.tech/tags/mvvm.md>), [network](<https://devfeed.tech/tags/network.md>), [networking](<https://devfeed.tech/tags/networking.md>), [presentation](<https://devfeed.tech/tags/presentation.md>), [responses](<https://devfeed.tech/tags/responses.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [viewmodel](<https://devfeed.tech/tags/viewmodel.md>)

### AI overview

This tutorial explains how to handle Retrofit API responses, errors, and exceptions across multi-layered Android architectures such as MVVM and MVI. It presents Sandwich as a type-safe, composable approach and covers response handling, composition, merging, global error mapping, and Flow integration.

### Source excerpt

Unsplash@picoftasty Modern Android applications commonly adopt multi-layered architectures such as MVVM or MVI, where data flows through distinct layers: a data source, a repository, and a ViewModel (or presentation layer). Each layer has a specific responsibility, and network responses must propagate through all of them before reaching the UI. While this separation produces clean, testable code, it introduces a real challenge: how do you handle API responses, including errors and exceptions, as they cross each layer boundary? Most developers solve this by wrapping API calls in try-catch blocks and returning fallback values. This works for small projects, but as the number of API calls grows, the approach creates ambiguous results, scattered boilerplate, and lost context that downstream layers need. You end up with ViewModels that cannot tell whether an empty list means "no data" or "network failure," repositories that swallow important error details, and data sources that repeat the same error handling pattern dozens of times. In this article, you'll explore the problems that emerge when handling Retrofit API calls across layered architectures, why conventional approaches break down at scale, and how Sandwich provides a type safe, composable solution that simplifies response handling from the network layer all the way to the UI. You'll also walk through the full set of Sandwich APIs, from basic response handling to advanced patterns like sequential composition, response merging, global error mapping, and Flow integration, each with real world use cases that show when and why you would reach for them. Retrofit API calls with coroutines Most Android projects use Retrofit with Kotlin coroutines for network communication. A typical service interface looks like this: https://medium.com/media/ebcba33386d664d1cf69a89234d2e22a/href The service returns a List<Poster> directly. Retrofit deserializes the JSON response body and gives you the data. This works perfectly when the

## runBlocking in practice: Where it should be used and where not

DevFeed: [runBlocking in practice: Where it should be used and where not](<https://devfeed.tech/articles/runblocking-in-practice-where-it-should-be-used-and-where-not-39373.md>)

Original publisher: [Read original article](<https://kt.academy/article/run_blocking>)

Published: 2025-09-01T00:00:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [runBlocking](<https://devfeed.tech/topics/runblocking.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [async](<https://devfeed.tech/tags/async.md>), [await](<https://devfeed.tech/tags/await.md>), [best-practices](<https://devfeed.tech/tags/best-practices.md>), [blocking](<https://devfeed.tech/tags/blocking.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [dispatcher](<https://devfeed.tech/tags/dispatcher.md>), [guide](<https://devfeed.tech/tags/guide.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [pitfalls](<https://devfeed.tech/tags/pitfalls.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [runblocking](<https://devfeed.tech/tags/runblocking.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

A practical guide to runBlocking in Kotlin Coroutines. It explains how runBlocking converts suspending calls into blocking calls, blocks the calling thread until completion, and creates a new coroutine hierarchy. The article discusses appropriate uses, code smells, and alternatives, including an Android Retrofit interceptor example.

### Source excerpt

A comprehensive guide to using runBlocking in Kotlin Coroutines, including best practices and common pitfalls.

## Developing for Android with a local REST API server

DevFeed: [Developing for Android with a local REST API server](<https://devfeed.tech/articles/developing-for-android-with-a-local-rest-api-server-25677.md>)

Original publisher: [Read original article](<https://blog.sanskar10100.dev/developing-for-android-with-a-local-rest-api-server>)

Author: Sanskar Agrawal

Published: 2022-12-26T09:17:38Z

Content type: tutorial

Language: en

Sources: [Sanskar's Stuff](<https://devfeed.tech/sources/sanskar-s-stuff.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [REST API](<https://devfeed.tech/topics/rest-api.md>), [Server](<https://devfeed.tech/topics/server.md>), [Development](<https://devfeed.tech/topics/development.md>), [HTTP](<https://devfeed.tech/topics/http.md>), [networking](<https://devfeed.tech/topics/networking.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [backend](<https://devfeed.tech/tags/backend.md>), [gson](<https://devfeed.tech/tags/gson.md>), [http](<https://devfeed.tech/tags/http.md>), [local](<https://devfeed.tech/tags/local.md>), [networking](<https://devfeed.tech/tags/networking.md>), [rest-api](<https://devfeed.tech/tags/rest-api.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [security](<https://devfeed.tech/tags/security.md>), [server](<https://devfeed.tech/tags/server.md>)

### AI overview

This tutorial explains how to connect an Android app to a REST API server running locally on a development machine. It covers configuring endpoints, using the machine's local address and port, connecting an emulator or physical device, and enabling HTTP while avoiding that setting in production.

### Source excerpt

When you're building an Android app, chances are that it'll be interacting with the internet in some way. More often than not, this is through the use of REST API. First, a refresher Ideally, you'd have a couple of base URLs, one for production usage...

## Basic Auth with OkHttp and Retrofit

DevFeed: [Basic Auth with OkHttp and Retrofit](<https://devfeed.tech/articles/basic-auth-with-okhttp-and-retrofit-22649.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/basic-auth-okhttp-retrofit-dagger>)

Author: James Shvarts

Published: 2022-11-05T22:25:12Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Android](<https://devfeed.tech/topics/android.md>), [HTTP](<https://devfeed.tech/topics/http.md>), [API](<https://devfeed.tech/topics/api.md>), [Dagger](<https://devfeed.tech/topics/dagger.md>), [Library](<https://devfeed.tech/topics/library.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [auth](<https://devfeed.tech/tags/auth.md>), [authentication](<https://devfeed.tech/tags/authentication.md>), [dagger-hilt](<https://devfeed.tech/tags/dagger-hilt.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [http](<https://devfeed.tech/tags/http.md>), [json](<https://devfeed.tech/tags/json.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [libraries](<https://devfeed.tech/tags/libraries.md>), [payload](<https://devfeed.tech/tags/payload.md>), [request](<https://devfeed.tech/tags/request.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [viewmodel](<https://devfeed.tech/tags/viewmodel.md>)

### AI overview

A tutorial showing how to perform authenticated HTTP GET requests in a Kotlin Android project using Basic Authentication with OkHttp, Retrofit, Dagger/Hilt, and Moshi.

### Source excerpt

Basic Auth example using OkHttp, Retrofit, Dagger in a Kotlin project

## Unconfined Enums Adapter for Moshi

DevFeed: [Unconfined Enums Adapter for Moshi](<https://devfeed.tech/articles/unconfined-enums-adapter-for-moshi-25914.md>)

Original publisher: [Read original article](<https://medium.com/@xxfast/unconfined-enums-adapter-for-moshi-5d84542c8bf0?source=rss-43bae76e8f81------2>)

Author: Isuru Rajapakse

Published: 2022-05-11T12:08:49Z

Content type: tutorial

Language: en

Sources: [Stories by Isuru Rajapakse on Medium](<https://devfeed.tech/sources/stories-by-isuru-rajapakse-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [LineageOS](<https://devfeed.tech/topics/lineageos.md>), [API](<https://devfeed.tech/topics/api.md>), [enum](<https://devfeed.tech/topics/enum.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [data-class](<https://devfeed.tech/tags/data-class.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enum-class](<https://devfeed.tech/tags/enum-class.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [moshi](<https://devfeed.tech/tags/moshi.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>)

### AI overview

This tutorial presents a Kotlin pattern for handling previously unknown enum-like values from REST APIs with Moshi. It explains Moshi enum adapters, the unknown-value fallback, and an interface-based approach that preserves the server's raw value instead of mapping it only to a generic unknown value.

### Source excerpt

If you wonder what an Unconfined Enum is, wonder no more because it is a thing I just made up. Enums by definition are confined, or finite. Therefore "unconfined enum" is really an oxymoron. Nevertheless, say you have this Fruit enum and want to map each value to an Android string resource. Kotlin's enum properties make this convenient enum class Fruit(@StringRes val stringRes: Int) { Apple(R.string.fruit_apple), Oranges(R.string.fruit_orange) } When we want to consume this enum from a Restful API with a Moshi converter, Moshi automatically generates the enum adapter for you, but if you want to customise the behaviour for whatever reason, you can do object FruitsAdapter { @ToJson fun toJson(type: Fruit): String = type.name @FromJson fun fromJson(name: String): Fruit = Fruit.values().first { it.name == name } } Happy days. Everything is working as expected. When things go bananascom.squareup.moshi.JsonDataException: Expected one of [Apple, Oranges] but was Bananas at path $ Good APIs don't break contracts. Not all APIs are good APIs, so some can break contracts. What do we do now? push out an update with added enum value and its string resource? Perhaps we can make use of EnumJsonAdapter's .withUnknownFallBack() enum class Fruit(@StringRes val stringRes: Int) { Apple(R.string.fruit_apple), Oranges(R.string.fruit_orange), Unknown(R.string.fruit_unknown) } Moshi.Builder() .add(KotlinJsonAdapterFactory()) .add(Fruit::class.java, EnumJsonAdapter.create(Fruit::class.java) .withUnknownFallback(Fruit.Unknown)) .build() This certainly stops the app from crashing, but what if we actually want to show the "bananas" that the API sends? you know, as a fail safe so that users wouldn't end up seeing "unknowns". Let's open up the Enums Enums are by definition finite. Enums are final by design. Enums can't be subclassed but they still can inherit interfaces. We will exploit this to create our "unconfined" enum interface Fruit { val name: String data class Unknown(override val name:

## Adventures in Tracking Upload Progress With OkHttp and Retrofit

DevFeed: [Adventures in Tracking Upload Progress With OkHttp and Retrofit](<https://devfeed.tech/articles/adventures-in-tracking-upload-progress-with-okhttp-and-retrofit-27034.md>)

Original publisher: [Read original article](<https://dev.to/zsmb13/adventures-in-tracking-upload-progress-with-okhttp-and-retrofit-1gff>)

Author: Márton Braun

Published: 2021-12-10T16:00:00Z

Content type: tutorial

Language: en

Sources: [zsmb.co](<https://devfeed.tech/sources/zsmb-co.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [SDKs](<https://devfeed.tech/topics/sdks.md>), [API](<https://devfeed.tech/topics/api.md>), [Code](<https://devfeed.tech/topics/code.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [Usability](<https://devfeed.tech/topics/usability.md>), [User experience (UX)](<https://devfeed.tech/topics/ux.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [coding](<https://devfeed.tech/tags/coding.md>), [community](<https://devfeed.tech/tags/community.md>), [development](<https://devfeed.tech/tags/development.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [inclusive](<https://devfeed.tech/tags/inclusive.md>), [networking](<https://devfeed.tech/tags/networking.md>), [okhttp](<https://devfeed.tech/tags/okhttp.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [sdk](<https://devfeed.tech/tags/sdk.md>), [software](<https://devfeed.tech/tags/software.md>), [usability](<https://devfeed.tech/tags/usability.md>), [ux](<https://devfeed.tech/tags/ux.md>)

### AI overview

This article explains how Stream's Android team refined file-upload progress tracking in the Stream Chat Android SDK. It presents an initial Retrofit and OkHttp callback-based implementation, discusses its usability issues, and describes a cleaner implementation using a custom OkHttp request body with progress callbacks.

### Source excerpt

Tracking file upload progress can have some unexpected complexities. This article tells the story of how we refined our implementation of this feature in the Stream Chat Android SDK.

## Going Fully Multiplatform #1: Migrating your Android Project to Kotlin Multiplatform

DevFeed: [Going Fully Multiplatform #1: Migrating your Android Project to Kotlin Multiplatform](<https://devfeed.tech/articles/going-fully-multiplatform-1-migrating-your-android-project-to-kotlin-multiplatform-25912.md>)

Original publisher: [Read original article](<https://medium.com/@xxfast/going-fully-multiplatform-1-migrating-your-android-project-to-kotlin-multiplatform-8fc38763307?source=rss-43bae76e8f81------2>)

Author: Isuru Rajapakse

Published: 2021-10-21T13:24:07Z

Content type: tutorial

Language: en

Sources: [Stories by Isuru Rajapakse on Medium](<https://devfeed.tech/sources/stories-by-isuru-rajapakse-on-medium.md>)

Topics: [Kotlin Multiplatform](<https://devfeed.tech/topics/kotlin-multiplatform.md>), [multiplatform](<https://devfeed.tech/topics/multiplatform.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Android](<https://devfeed.tech/topics/android.md>), [iOS](<https://devfeed.tech/topics/ios.md>), [Ktor](<https://devfeed.tech/topics/ktor.md>), [Web](<https://devfeed.tech/topics/web.md>), [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [koin](<https://devfeed.tech/topics/koin.md>), [RxJava](<https://devfeed.tech/topics/rxjava.md>), [navigation](<https://devfeed.tech/topics/navigation.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [caching](<https://devfeed.tech/tags/caching.md>), [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [ktor](<https://devfeed.tech/tags/ktor.md>), [libraries](<https://devfeed.tech/tags/libraries.md>), [moshi](<https://devfeed.tech/tags/moshi.md>), [multiplatform](<https://devfeed.tech/tags/multiplatform.md>), [navigation](<https://devfeed.tech/tags/navigation.md>), [okhttp](<https://devfeed.tech/tags/okhttp.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>)

### AI overview

The article describes migrating an Android-only application to Kotlin Multiplatform. It compares the existing Android stack with a planned multiplatform stack targeting Android, JVM, iOS, and Web, including changes to networking, serialization, caching, dependency injection, asynchronous plumbing, navigation, and UI.

### Source excerpt

Earlier this year I started a mission to start migrating one of our long-lasting Android-only apps to Kotlin Multiplatform to go beyond just Android. This is the story of how that went. Migration from Only-Android to Kotlin Multiplatform!The Android stack This is our current "stack" our android app was set up as follows Targeting Android SDK API 23 or above, we had a few libraries to help us out. The Android-only stack OkHttp for Networking Retrofit for.. also Networking Moshi for serialisation Okio for caching Koin for Dependency Injection/ Service Locator Plumbing with RxJava Navigation with Conductor Imperative UI with Android Views written in XML The Multiplatform stack To go beyond just Android, I had to make some hard decisions to step outside of the comfort zone that we've been so fond of To target Android, JVM, iOS and Web -- we will be making use of The Multiplatform stack Ktor for Networking Kotlin Serialisation for.. serialisation Caching with SQLDelight Koin for Dependency Injection (that one can stay) Plumbing with Coroutine Flows Navigation with Decompose Declarative UI powered with Jetpack/Jetbrains Compose That's the plan! In the next few articles, we'll take a look at each step in more detail. Before jumping on to that -- I want to take a close look at how we can fully modularise a Kotlin Multiplatform project with Going Fully Multiplatform #2 Modularising your Kotlin Multiplatform Project!

## Converting LiveData to Flow: Lessons learned

DevFeed: [Converting LiveData to Flow: Lessons learned](<https://devfeed.tech/articles/converting-livedata-to-flow-lessons-learned-25902.md>)

Original publisher: [Read original article](<https://chao2zhang.medium.com/converting-livedata-to-flow-lessons-learned-9362a00611c8?source=rss-d19045640fe------2>)

Author: Chao Zhang

Published: 2021-04-03T01:13:26Z

Content type: tutorial

Language: en

Sources: [Stories by Chao Zhang on Medium](<https://devfeed.tech/sources/stories-by-chao-zhang-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>), [Android](<https://devfeed.tech/topics/android.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [App](<https://devfeed.tech/topics/app.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [flow](<https://devfeed.tech/tags/flow.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [lifecycle](<https://devfeed.tech/tags/lifecycle.md>), [livedata](<https://devfeed.tech/tags/livedata.md>), [network](<https://devfeed.tech/tags/network.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [rotation](<https://devfeed.tech/tags/rotation.md>), [viewmodel](<https://devfeed.tech/tags/viewmodel.md>)

### AI overview

This tutorial examines lessons from converting Kotlin Flow to LiveData with Flow<T>.asLiveData() in an Android app. It explains why flow collection may be re-executed after screen rotation and identifies creating a new LiveData instance instead of preserving it as a property as the bug causing recollection.

### Source excerpt

Photo: Robert Lukeman from Unsplash Android KTX provides opinionated methods, such asFlow<T>.asLiveData(), facilitating using Kotlin Coroutines in Android Architecture Components. Make sure to understand their behaviors underneath before using them! The official documentation on Kotlin coroutines on Android is quitewell-written, while there are numerous article posts covering the basics. In this story, we will focus on the lessons learned when using these extension methods, usingFlow<T>.asLiveData() as an example. Setup Let's start with a concrete example using the orthodox Android App Architecture: Repository + ViewModel + Fragment https://medium.com/media/a59f3702376fe64d61dd5c3dd72c9c15/href RedditService is a simple Retrofit service. We also added logging statements inside the flow collecting block. https://medium.com/media/a904400508a241bae454d44e0f01a9b9/href We use Flow<T>.asLiveData() to convert the flow into a LiveData. https://medium.com/media/97cb5995c53c5d86606a371ef905d25d/href In the fragment layer, we added logging statements for the fragment lifecycle calls and used Thread.sleep(500)to simulate complex layout inflation. Lesson I: Flow collection is re-executed after rotating the screen When we run the app, it looks fine. However, after rotating the device screen to recreate the fragment, we can observe more logs like flow running... indicating the flow is executed. 2021-04-02 16:41:32.246 I: Fragment onCreate... 2021-04-02 16:41:32.247 I: Fragment onCreateView... 2021-04-02 16:41:32.754 I: Fragment onStart... 2021-04-02 16:41:32.755 I: flow running... 2021-04-02 16:41:32.756 I: Fragment onResume... 2021-04-02 16:41:33.309 I: Observer called... That is weird! The original intention of ViewModel is to persist data that can survive UI recreation. After we rotate the device screen, the data should be retrieved from the storage. Contrarily, what we saw is that the data is fetched again from the service, which may cause unnecessary network calls or UI flic

## Using Retrofit and Alamofire with Kotlin Serialization on Kotlin Multiplatform

DevFeed: [Using Retrofit and Alamofire with Kotlin Serialization on Kotlin Multiplatform](<https://devfeed.tech/articles/using-retrofit-and-alamofire-with-kotlin-serialization-on-kotlin-multiplatform-25546.md>)

Original publisher: [Read original article](<https://www.marcogomiero.com/posts/2020/kotlin-serialization-alamofire/>)

Author: Marco Gomiero

Published: 2020-12-10T00:00:00Z

Content type: tutorial

Language: en

Sources: [Posts on Marco Gomiero](<https://devfeed.tech/sources/posts-on-marco-gomiero.md>)

Topics: [Kotlin Multiplatform](<https://devfeed.tech/topics/kotlin-multiplatform.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Mobile](<https://devfeed.tech/topics/mobile.md>), [Android](<https://devfeed.tech/topics/android.md>), [iOS](<https://devfeed.tech/topics/ios.md>), [Library](<https://devfeed.tech/topics/library.md>), [API](<https://devfeed.tech/topics/api.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [backend](<https://devfeed.tech/tags/backend.md>), [kmp](<https://devfeed.tech/tags/kmp.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlin-serialization](<https://devfeed.tech/tags/kotlin-serialization.md>), [ktor](<https://devfeed.tech/tags/ktor.md>), [library](<https://devfeed.tech/tags/library.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [network](<https://devfeed.tech/tags/network.md>), [rest](<https://devfeed.tech/tags/rest.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [serialization](<https://devfeed.tech/tags/serialization.md>), [swift](<https://devfeed.tech/tags/swift.md>)

### AI overview

This tutorial explains how to use Retrofit on Android and Alamofire on iOS in a Kotlin Multiplatform Mobile application while sharing DTO definitions and Kotlin Serialization-based deserialization across the KMP module and mobile clients.

### Source excerpt

If you are starting a project with Kotlin Multiplatform and you want to share the network layer, the best way to go is definitely with Ktor. But if you don't want to share the entire network layer but maybe only the DTOs? There could be many reasons for wanting this. Maybe you are starting to integrate Kotlin Multiplatform (I'll call it KMP in the rest of the article) into an existing project and the work for sharing the entire network layer is simply too much.

## Repository Pattern: Properly Organizing Your Data Layer

DevFeed: [Repository Pattern: Properly Organizing Your Data Layer](<https://devfeed.tech/articles/repository-pattern-properly-organizing-your-data-layer-22832.md>)

Original publisher: [Read original article](<http://androidessence.com/repository-pattern/>)

Author: Adam McNeilly

Published: 2019-05-20T00:00:00Z

Content type: tutorial

Language: en

Sources: [Android Essence](<https://devfeed.tech/sources/android-essence.md>)

Topics: [App](<https://devfeed.tech/topics/app.md>), [Code](<https://devfeed.tech/topics/code.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [API](<https://devfeed.tech/topics/api.md>), [GraphQL](<https://devfeed.tech/topics/graphql.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [code](<https://devfeed.tech/tags/code.md>), [developers](<https://devfeed.tech/tags/developers.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [programming](<https://devfeed.tech/tags/programming.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [viewmodel](<https://devfeed.tech/tags/viewmodel.md>)

### AI overview

This tutorial explains the Repository Pattern for organizing an application's data layer. It shows how separating data access from a ViewModel or Presenter can keep those classes focused on requesting data while allowing the underlying source to change, such as between a Retrofit service, GraphQL API, or local database.

### Source excerpt

How to properly architect your application is a concern we as developers constantly face. There's unfortunately no one size fits all answer to it, and sometimes we don't even know where to begin. I've learned along my Android journey that the answer can also vary depending on what portion of your app you're trying to organize. Of course, you might say, it depends. When it comes to your data layer, though, there are some really good tips on how to write clean, maintainable code. One of them is the Repository Pattern, and I'd like to provide a quick walk through of what it is and why it's important.

## Retrofit meets coroutines

DevFeed: [Retrofit meets coroutines](<https://devfeed.tech/articles/retrofit-meets-coroutines-27081.md>)

Original publisher: [Read original article](<https://zsmb.co/retrofit-meets-coroutines/>)

Author: Márton Braun

Published: 2019-02-15T22:00:00Z

Content type: tutorial

Language: en

Sources: [zsmb.co](<https://devfeed.tech/sources/zsmb-co.md>)

Topics: [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>), [REST API](<https://devfeed.tech/topics/rest-api.md>), [API](<https://devfeed.tech/topics/api.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [cancellation](<https://devfeed.tech/tags/cancellation.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [demo](<https://devfeed.tech/tags/demo.md>), [exception](<https://devfeed.tech/tags/exception.md>), [gson](<https://devfeed.tech/tags/gson.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [marton-braun](<https://devfeed.tech/tags/marton-braun.md>), [networking](<https://devfeed.tech/tags/networking.md>), [rest-api](<https://devfeed.tech/tags/rest-api.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [serialization](<https://devfeed.tech/tags/serialization.md>), [zsmb](<https://devfeed.tech/tags/zsmb.md>), [zsmb-co](<https://devfeed.tech/tags/zsmb-co.md>), [zsmb13](<https://devfeed.tech/tags/zsmb13.md>), [zsmbco](<https://devfeed.tech/tags/zsmbco.md>)

### AI overview

This tutorial explains how to use Retrofit 2.6.0 or later with Kotlin coroutines. It demonstrates coroutine-based API calls, Gson serialization, exception propagation, cancellation, and response-handling variants using the SpaceX REST API.

### Source excerpt

Retrofit's coroutine support has been a long time coming, and it's finally coming to completion. Take a look at how you can use it to neatly integrate networking into an application built with coroutines.

## Reactive Pipelines in Action

DevFeed: [Reactive Pipelines in Action](<https://devfeed.tech/articles/reactive-pipelines-in-action-29373.md>)

Original publisher: [Read original article](<https://arturdryomov.dev/posts/reactive-pipelines/>)

Author: Artur Dryomov

Published: 2018-11-07T00:00:00Z

Content type: article

Language: en

Sources: [Artur Dryomov](<https://devfeed.tech/sources/artur-dryomov.md>)

Topics: [reactive](<https://devfeed.tech/topics/reactive.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [architecture](<https://devfeed.tech/tags/architecture.md>), [connectivity](<https://devfeed.tech/tags/connectivity.md>), [data](<https://devfeed.tech/tags/data.md>), [functional-programming](<https://devfeed.tech/tags/functional-programming.md>), [network](<https://devfeed.tech/tags/network.md>), [pipelines](<https://devfeed.tech/tags/pipelines.md>), [programming](<https://devfeed.tech/tags/programming.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [state](<https://devfeed.tech/tags/state.md>), [stream](<https://devfeed.tech/tags/stream.md>), [triggers](<https://devfeed.tech/tags/triggers.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

An exploration of reactive programming and functional-reactive pipelines, describing how producers and consumers can be connected into consistent event flows. Examples include network connectivity changes and refresh actions triggering requests, state updates, and UI redraws within a multitier architecture.

### Source excerpt

Human beings are reactive by nature -- fortunately or not. The reason is mostly physiology. The dopamine hormone helps us to feel comfortable and secure while we do familiar things. Eating a sandwich sounds and feels far better than gardening, doesn't it? Essentially it is a fight between psychology (the mind, proactive actions) and physiology (the body, reactive actions). The same thing happens in CS. Object-oriented programming (OOP) is the king of the hill and functional programming (FP) is on the outskirts. Well, it is this way because the OOP is more comfortable for the majority. We, as a society, made it this way. The educational system includes a mandatory OOP course and rarely there is an FP one. And then there is reactive programming which forms a wild beast called functional-reactive programming (FRP)...

## Band-aiding legacy networking libraries with Retrofit and OkHttp

DevFeed: [Band-aiding legacy networking libraries with Retrofit and OkHttp](<https://devfeed.tech/articles/band-aiding-legacy-networking-libraries-with-retrofit-and-okhttp-29035.md>)

Original publisher: [Read original article](<https://saket.me/retrofit-band-aid/>)

Author: Saket Narayan

Published: 2018-04-30T09:22:05Z

Content type: tutorial

Language: en

Sources: [Saket Narayan](<https://devfeed.tech/sources/saket-narayan.md>)

Topics: [legacy](<https://devfeed.tech/topics/legacy.md>), [networking](<https://devfeed.tech/topics/networking.md>), [HTTP](<https://devfeed.tech/topics/http.md>), [Library](<https://devfeed.tech/topics/library.md>), [API](<https://devfeed.tech/topics/api.md>), [MQTT](<https://devfeed.tech/topics/mqtt.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [apis](<https://devfeed.tech/tags/apis.md>), [http](<https://devfeed.tech/tags/http.md>), [legacy](<https://devfeed.tech/tags/legacy.md>), [libraries](<https://devfeed.tech/tags/libraries.md>), [networking](<https://devfeed.tech/tags/networking.md>), [okhttp](<https://devfeed.tech/tags/okhttp.md>), [refactor](<https://devfeed.tech/tags/refactor.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>)

### AI overview

This tutorial explains how to use Retrofit with a legacy networking library by adding an OkHttp interceptor that redirects network requests to the existing library. It also describes exposing nonstandard data sources through Retrofit converters.

### Source excerpt

When Uncommon was brought in to refactor a big legacy app last year, we found ourselves in a strange situation. Our client was maintaining a common library for handling networking -- HTTP, FCM, MQTT -- across all apps under their brand. This library (let's call it SadLibrary) had an API that was badly designed and dated, but not using [...] The post Band-aiding legacy networking libraries with Retrofit and OkHttp appeared first on Saket Narayan.

## Opinion, should we prefix JAX-RS Path value with a slash ?

DevFeed: [Opinion, should we prefix JAX-RS Path value with a slash ?](<https://devfeed.tech/articles/opinion-should-we-prefix-jax-rs-path-value-with-a-slash-26091.md>)

Original publisher: [Read original article](<https://blog.arkey.fr/tomb/uri_paths_with_trailing_or_leading_slashes/>)

Author: brice.dutheil@gmail.com (Brice Dutheil)

Published: 2018-02-20T00:00:00Z

Content type: opinion

Language: en

Sources: [The Coffee Workshop](<https://devfeed.tech/sources/the-coffee-workshop.md>)

Topics: [HTTP](<https://devfeed.tech/topics/http.md>), [client](<https://devfeed.tech/topics/client.md>), [browsers](<https://devfeed.tech/topics/browsers.md>), [Linux](<https://devfeed.tech/topics/linux.md>)

Tags: [browsers](<https://devfeed.tech/tags/browsers.md>), [http](<https://devfeed.tech/tags/http.md>), [linux](<https://devfeed.tech/tags/linux.md>), [okhttp](<https://devfeed.tech/tags/okhttp.md>), [opinion](<https://devfeed.tech/tags/opinion.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [server](<https://devfeed.tech/tags/server.md>), [standards](<https://devfeed.tech/tags/standards.md>)

### AI overview

This opinion examines whether JAX-RS path annotations should use a leading slash. It explains that JAX-RS treats paths with and without leading or trailing slashes similarly, while Retrofit and OkHttp resolve a leading slash as an absolute URL path, making slash placement semantically significant on the client side.

### Source excerpt

In the past months I have been using extensively the infamous HTTP client OkHTTP, I have been impressed by the will power of committers to respect HTTP standards. My co-workers which have various degrees of knowledge and experience in different language ecosystem work on a server-side application with some JAX-RS endpoints, and this question arose:

## Doppl Sample Update - Kevin Galligan

DevFeed: [Doppl Sample Update - Kevin Galligan](<https://devfeed.tech/articles/doppl-sample-update-kevin-galligan-38189.md>)

Original publisher: [Read original article](<https://touchlab.co/doppl-sample-update>)

Published: 2017-10-04T15:00:55Z

Content type: article

Language: en

Sources: [Touchlab | Enterprise Mobile Innovation & Development](<https://devfeed.tech/sources/touchlab-enterprise-mobile-innovation-development.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [RxJava](<https://devfeed.tech/topics/rxjava.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Xcode](<https://devfeed.tech/topics/xcode.md>), [Objective-C](<https://devfeed.tech/topics/objective-c.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-library](<https://devfeed.tech/tags/android-library.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [built-by-touchlab](<https://devfeed.tech/tags/built-by-touchlab.md>), [code-sharing](<https://devfeed.tech/tags/code-sharing.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [objective-c](<https://devfeed.tech/tags/objective-c.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [update](<https://devfeed.tech/tags/update.md>), [version](<https://devfeed.tech/tags/version.md>), [xcode](<https://devfeed.tech/tags/xcode.md>)

### AI overview

A progress update on Touchlab's Doppl libraries and sample apps. The update covers compatibility work for J2objc 2.0.4, redeployed libraries, Party Clicker, reactive Room architecture code, and planned work on RxJava 2, Retrofit 2, Xcode support, the Gradle plugin, Architecture Components, and Kotlin.

### Source excerpt

We're going through and updating Doppl libs & sample apps. For the next few months, we'll be working with 2.0.4 and locking down the libraries and versions.

## How to use Retrofit on android with Kotlin (KAD 21)

DevFeed: [How to use Retrofit on android with Kotlin (KAD 21)](<https://devfeed.tech/articles/how-to-use-retrofit-on-android-with-kotlin-kad-21-27224.md>)

Original publisher: [Read original article](<https://antonioleiva.com/retrofit-android-kotlin>)

Published: 2017-04-18T00:00:00Z

Content type: tutorial

Language: en

Sources: [Antonio Leiva](<https://devfeed.tech/sources/antonio-leiva.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [API](<https://devfeed.tech/topics/api.md>), [Library](<https://devfeed.tech/topics/library.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [Gson](<https://devfeed.tech/topics/gson.md>), [Java](<https://devfeed.tech/topics/java.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [build](<https://devfeed.tech/tags/build.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [gson](<https://devfeed.tech/tags/gson.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [okhttp](<https://devfeed.tech/tags/okhttp.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>)

### AI overview

A Kotlin tutorial showing how to integrate Retrofit 2 into an Android application for making LastFM API requests. It covers Gradle dependencies, OkHttp logging, Gson conversion, request interfaces, service initialization, and making requests with extension functions.

### Source excerpt

Everything Android, Kotlin and other random topics

## How a JDK Throwable API Design Issue Caused Bugs in RxJava and Retrofit

DevFeed: [How a JDK Throwable API Design Issue Caused Bugs in RxJava and Retrofit](<https://devfeed.tech/articles/no-cause-for-concern-rxjava-and-retrofit-throwing-a-tantrum-15781.md>)

Original publisher: [Read original article](<https://developer.squareup.com/blog/no-cause-for-concern-rxjava-and-retrofit-throwing-a-tantrum>)

Author: P-Y Ricau

Published: 2016-11-02T19:47:30Z

Content type: tutorial

Language: en

Sources: [Square Corner Blog](<https://devfeed.tech/sources/square-corner-blog-medium.md>), [Square Corner Blog RSS Feed](<https://devfeed.tech/sources/square-corner-blog-rss-feed.md>)

Topics: [API](<https://devfeed.tech/topics/api.md>), [Exception](<https://devfeed.tech/topics/exception.md>), [debugging](<https://devfeed.tech/topics/debugging.md>), [debug](<https://devfeed.tech/topics/debug.md>), [Code](<https://devfeed.tech/topics/code.md>), [LineageOS](<https://devfeed.tech/topics/lineageos.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [code](<https://devfeed.tech/tags/code.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [exception](<https://devfeed.tech/tags/exception.md>), [jdk](<https://devfeed.tech/tags/jdk.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>)

### AI overview

This technical write-up explains how an API design issue in the JDK Throwable class caused bugs in RxJava and Retrofit when RxJava assembly tracking was enabled. It traces the resulting exception behavior through logs and source code.

### Source excerpt

Last week, we found an interesting API design issue in the Throwable class of the JDK that led to bugs in RxJava and Retrofit. This is a...

## Retrofit 2.0 Samples

DevFeed: [Retrofit 2.0 Samples](<https://devfeed.tech/articles/retrofit-2-0-samples-31827.md>)

Original publisher: [Read original article](<https://www.metachris.dev/2015/10/retrofit-2-samples/>)

Author: Chris Hager

Published: 2015-10-12T00:00:00Z

Content type: tutorial

Language: en

Sources: [Chris Hager](<https://devfeed.tech/sources/chris-hager.md>)

Topics: [Library](<https://devfeed.tech/topics/library.md>), [API](<https://devfeed.tech/topics/api.md>), [client library](<https://devfeed.tech/topics/client-library.md>), [Java](<https://devfeed.tech/topics/java.md>), [Gson](<https://devfeed.tech/topics/gson.md>), [HTTP](<https://devfeed.tech/topics/http.md>), [Android](<https://devfeed.tech/topics/android.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [JSON](<https://devfeed.tech/topics/json.md>), [GitHub](<https://devfeed.tech/topics/github.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [articles](<https://devfeed.tech/tags/articles.md>), [client-library](<https://devfeed.tech/tags/client-library.md>), [github](<https://devfeed.tech/tags/github.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [gson](<https://devfeed.tech/tags/gson.md>), [java](<https://devfeed.tech/tags/java.md>), [json](<https://devfeed.tech/tags/json.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>)

### AI overview

A tutorial on using Retrofit 2.0 beta to consume HTTP APIs in Java and Android applications. It covers project setup with Gradle, JSON serialization with Gson, API client definitions, and sample GET and POST requests against httpbin.org.

### Source excerpt

This post is about using Retrofit 2.0 (beta) to consume HTTP based APIs. Retrofit is a great and popular API client library for Java (and by extension also for Android) developed by Square. Here's a few links to start things off: Retrofit Homepage Retrofit Source on Github Retrofit Javadoc Blog post about Retrofit 2.0 Source code with samples for this post is available on Github. Retrofit makes it easy to develop API clients by describing API endpoints and the results like this:

## Easy HTTP Requests with Retrofit

DevFeed: [Easy HTTP Requests with Retrofit](<https://devfeed.tech/articles/easy-http-requests-with-retrofit-15617.md>)

Original publisher: [Read original article](<https://developer.squareup.com/blog/easy-http-requests-with-retrofit>)

Author: Square Engineering

Published: 2013-05-13T16:03:00Z

Content type: tutorial

Language: en

Sources: [Jake Wharton](<https://devfeed.tech/sources/jake-wharton.md>), [Square Corner Blog](<https://devfeed.tech/sources/square-corner-blog-medium.md>), [Square Corner Blog RSS Feed](<https://devfeed.tech/sources/square-corner-blog-rss-feed.md>)

Topics: [HTTP](<https://devfeed.tech/topics/http.md>), [Application Development](<https://devfeed.tech/topics/application-development.md>), [API](<https://devfeed.tech/topics/api.md>), [Library](<https://devfeed.tech/topics/library.md>), [Open Source](<https://devfeed.tech/topics/open-source.md>), [Java](<https://devfeed.tech/topics/java.md>), [GitHub](<https://devfeed.tech/topics/github.md>), [GitHub API](<https://devfeed.tech/topics/github-api.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [application-development](<https://devfeed.tech/tags/application-development.md>), [code](<https://devfeed.tech/tags/code.md>), [declarative](<https://devfeed.tech/tags/declarative.md>), [development](<https://devfeed.tech/tags/development.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [github](<https://devfeed.tech/tags/github.md>), [http](<https://devfeed.tech/tags/http.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [java](<https://devfeed.tech/tags/java.md>), [library](<https://devfeed.tech/tags/library.md>), [network](<https://devfeed.tech/tags/network.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [request](<https://devfeed.tech/tags/request.md>), [responses](<https://devfeed.tech/tags/responses.md>), [rest](<https://devfeed.tech/tags/rest.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>)

### AI overview

This tutorial introduces Retrofit, Square's open source library for making HTTP requests through declarative, type-safe interfaces. It demonstrates calling GitHub's contributors API for the OkHttp project and explains how annotations, method arguments, and RestAdapter map interfaces to network requests.

### Source excerpt

A declarative, type-safe REST client.