Join us from October 8-10 in New York City to learn the latest tips, trends, and news about GraphQL Federation and API platform engineering.Join us for GraphQL Summit 2024 in NYC
Docs
Start for Free

Migrating to 2.0

Migrate to Apollo Android 2.0


Kotlin Multiplatform

We are really excited to announce that with this release it is possible to build Kotlin Multiplatform apps with Apollo. The supported targets are Android / iOS / JVM.

Please check-out samples/multiplatform for sample application.

This is a backward compatible change for existing users. Please keep in mind that it will bring Kotlin standard library as a transitive dependency.

Side effect changes of Kotlin migration:

Okio migration

Okio has been updated to 2.4.3 for Kotlin multiplatform.

The new version of okio is binary compatible. There are some source incompatible changes for Kotlin users like Java static function being moved to Kotlin extension functions.

If you explicitly depend okio, it is recommended to do a major version upgrade before upgrading Apollo.

Note: while we initially considered upgrading Okhttp to version 4.x, we ultimately reverted the change to keep compatibility with Android 4.4. More details in #2054 and 2269.

New Normalized Cache Modules

For in-memory LruNormalizedCache users, no change required since apollo-runtime brings it as transitive dependency. It is still recommended adding the following dependency explicitly: implementation("com.apollographql.apollo3:apollo-normalized-cache:x.y.z")

Apollo normalized cache module (#2142)

SqlNormalizedCache is moved to its own module. If you added apollo-android-support for disk cache, replace it with new dependency.

build.gradle
// Replace:
implementation("com.apollographql.apollo3:deprecated-apollo-android-support:x.y.z")
// With:
implementation("com.apollographql.apollo3:apollo-normalized-cache-sqlite:x.y.z")

ApolloSqlHelper is deprecated. Instantiate SqlNormalizedCacheFactory with same instead.

// Replace:
val apolloSqlHelper = ApolloSqlHelper.create(context, "db_name");
val cacheFactory = SqlNormalizedCacheFactory(apolloSqlHelper);
// With:
val cacheFactory = SqlNormalizedCacheFactory(context, "db_name");
// Replace:
ApolloSqlHelper apolloSqlHelper = ApolloSqlHelper.create(context, "db_name");
NormalizedCacheFactory cacheFactory = new SqlNormalizedCacheFactory(apolloSqlHelper);
// With:
NormalizedCacheFactory cacheFactory = new SqlNormalizedCacheFactory(context, "db_name");

Replace legacy Android SQL with SqlDelight (#2158)

Deprecated Gradle Plugin

The deprecated Gradle Plugin is now removed. Please refer to the migration guide from previous releases before upgrading to 2.0.

Next
Get Started
Rate articleRateEdit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc., d/b/a Apollo GraphQL.

Privacy Policy

Company