You are viewing documentation for a previous version of this software.

Switch to the latest stable version.

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:

  • Some primitive types like Booleans may be unboxed where appropriate

  • Classes and functions are final unless they are intentionally marked as open

  • Kotlin-stdlib is added as a transitive dependency

  • Jvm target version is now 1.8. See the Android Developer website for details on how to enable it in yout project.

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.

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

ApolloSqlHelper is deprecated. Instantiate SqlNormalizedCacheFactory with same arguments instead.

Kotlin
Java
1// Replace:
2val apolloSqlHelper = ApolloSqlHelper.create(context, "db_name");
3val cacheFactory = SqlNormalizedCacheFactory(apolloSqlHelper);
4
5// With:
6val cacheFactory = 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.

Feedback

Edit on GitHub

Forums