# Medium Android App -- Migrating from Apollo Kotlin 3 to 4: Lessons Learned

DevFeed: [Medium Android App -- Migrating from Apollo Kotlin 3 to 4: Lessons Learned](<https://devfeed.tech/articles/medium-android-app-migrating-from-apollo-kotlin-3-to-4-lessons-learned-20324.md>)

Original publisher: [Read original article](<https://medium.engineering/medium-android-app-migrating-from-apollo-kotlin-3-to-4-lessons-learned-ff8d0d861cdb?source=rss----2817475205d3---4>)

Author: Pierrick CAEN

Published: 2025-10-06T08:18:42Z

Content type: article

Language: en

Sources: [Medium](<https://devfeed.tech/sources/medium.md>)

Topics: [apollo-client](<https://devfeed.tech/topics/apollo-client.md>), [experience report](<https://devfeed.tech/topics/experience-report.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Error Handling](<https://devfeed.tech/topics/error-handling.md>), [Exception handling](<https://devfeed.tech/topics/exception-handling.md>), [Android](<https://devfeed.tech/topics/android.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [IntelliJ IDEA](<https://devfeed.tech/topics/intellij-idea.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [apollo](<https://devfeed.tech/tags/apollo.md>), [apollo-client](<https://devfeed.tech/tags/apollo-client.md>), [cache](<https://devfeed.tech/tags/cache.md>), [exception-handling](<https://devfeed.tech/tags/exception-handling.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [medium](<https://devfeed.tech/tags/medium.md>), [migration](<https://devfeed.tech/tags/migration.md>), [network](<https://devfeed.tech/tags/network.md>), [performance](<https://devfeed.tech/tags/performance.md>), [ui](<https://devfeed.tech/tags/ui.md>)

## AI overview

The Medium Android migration from Apollo Kotlin 3 to 4 exposed cache misses in `watch()` calls because Apollo 4 surfaces exceptions through `ApolloResponse`, including misses that had previously gone unnoticed. The app used `FetchPolicy.CacheFirst` and watched normalized-cache changes for live UI updates. The author traced misses to faulty programmatic cache keys, switched to declarative type and field policies, and configured `__typename` on all operations. Watchers now return `Result` values and filter expected cache or network exceptions according to fetch policy, since fallback responses may follow. The migration also updated exception handling, replaced `executeV3()` with `execute()`, and removed `fetchThrows = true`. The author added a Currency scalar adapter. HTTP batching and persisted queries are described as future improvements; persisted queries require backend support.

## Source excerpt

Photo by Mario Verduzco on UnsplashMedium Android App -- Migrating from Apollo Kotlin 3 to 4: Lessons Learned In this post, I'll share my experience migrating the Medium Android app from Apollo Kotlin version 3 to version 4, including the challenges I encountered and how I solved them to improve our GraphQL implementation. Understanding Our Apollo Cache Implementation Before diving into the migration, it's important to understand how we use Apollo's cache in the Medium Android app. Our app relies heavily on Apollo's normalized cache for several critical purposes: Performance Optimization: We use FetchPolicy.CacheFirst as our default strategy, which means we always try to serve data from the cache first before making network requests. This significantly reduces loading times and provides a smooth user experience, especially when users navigate between screens that display similar content. Real-time Updates: We use Apollo's watch() functionality extensively to observe cache changes and automatically update our UI when data changes. This is particularly useful for features like: Live clap counts on posts Real-time follower updates Post viewed updates and more... Starting the Migration The initial plan was straightforward: update Apollo Kotlin from version 3 to 4. The IntelliJ plugin made this process seem simple at first glance. Key Changes in Apollo Kotlin 4 Group id / plugin id / package name: Apollo Kotlin 4 uses a new identifier (com.apollographql.apollo) for its maven group id, Gradle plugin id, and package name. This change from com.apollographql.apollo3 allows running version 4 alongside version 3 if needed. Source: Apollo Kotlin Migration Guide - Group id / plugin id / package name Exception handling: Apollo 4 has a new way of handling exceptions. Instead of throwing exceptions directly, they're now passed through ApolloResponse. Source: Apollo Kotlin Migration Guide -- Fetch errors do not throw ApolloCompositeException: In Apollo Kotlin 3, when both cache and netw