[android][breaking] compile with kotlin 2.x and raise api / language version#75
Merged
Conversation
markmur
approved these changes
May 13, 2026
6c52e72 to
1d113b1
Compare
tiagocandido
approved these changes
May 13, 2026
kieran-osgood-shopify
approved these changes
May 13, 2026
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
15 tasks
1d113b1 to
f5ed660
Compare
f5ed660 to
baeaca6
Compare
baeaca6 to
d6d3dbf
Compare
14 tasks
Contributor
Author
This was referenced May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Bumps the Kotlin compiler (and serialization plugin) from 1.9.23 to 2.3.21, and raises the consumer-floor pin (
apiVersion/languageVersion) from Kotlin 1.9 to Kotlin 2.0.This is a breaking change for consumers. Raising
apiVersion/languageVersionmakes Kotlin 2.0+ the required consumer floor — anyone still building against 1.9 can't consume the new AAR. Bundling this into the next major release is deliberate (see below).First of a stack of PRs preparing the next major release.
Why now
apiVersion/languageVersionbump together means consumers cross the breaking boundary once. If we bumped just the compiler now and the pin later, consumers would absorb two separate "minimum Kotlin" raises in successive releases.Why pin 2.0 and not 2.1
We considered raising the pin to Kotlin 2.1 — it would silence a compiler warning we now carry (see below) and buy more runway before the next forced break. Pin 2.0 was the deliberate choice for consumer reach:
platforms/react-native/claimsreact-native: "*"peer compatibility. RN templates ship Kotlin 1.9 on RN ≤ 0.76, Kotlin 2.0 on RN 0.77/0.78, Kotlin 2.1+ on RN 0.79+. Pin 2.0 keeps RN 0.77+ consumers reachable; pin 2.1 would cut off two RN minors that are still very common in production given how painful RN upgrades are.Accepted trade-off: LV 2.0 deprecation warning in our build
Kotlin 2.3's compiler now emits
Language version 2.0 is deprecated and its support will be removed in a future version of Kotlin. Update the version to 2.1.on every:lib:compile*Kotlininvocation. We accept this warning rather than bump the pin to 2.1:lib.apiimpact from the 2.3 compiler bump (verified —apiDumpproduced zero diff vs the 2.1.20 dump).Changes
build.gradle: Kotlin plugins (org.jetbrains.kotlin.android,org.jetbrains.kotlin.plugin.serialization) 1.9.23 → 2.3.21.lib/build.gradle:apiVersion/languageVersionpinned toKotlinVersion.KOTLIN_2_0; explanatory comment updated.gradle.properties(root + sample): AGP-opt-out comment block rewritten.android.builtInKotlin=falseandandroid.newDsl=falseremain, now documented as tooling-gap workarounds (BCV #312, KT-71172) rather than as Kotlin-version-specific.lib/api/lib.api: regenerated. 780 / 780 line diff, all inside auto-generated kotlinx-serialization$$serializercompanion classes flipping tosyntheticwithfinalmethods (a language-2.0 codegen change, not a human-authored API change).CLAUDE.md: references to the Kotlin pin updated 1.9 → 2.0.Why we're not on AGP 9's built-in Kotlin
AGP 9 ships a built-in Kotlin plugin that replaces
org.jetbrains.kotlin.android, but neither of our API-validation paths works with it for Android libraries today:binary-compatibility-validatorlistens for thekotlin-androidplugin id, which AGP's built-in path doesn't apply (BCV #312) —:lib:apiCheck/:lib:apiDumpsilently never register, so our public-API gate disappears.abiValidationDSL exists for JVM and Multiplatform but is not yet exposed onKotlinAndroidProjectExtension(KT-71172).We stay on the explicit
org.jetbrains.kotlin.androidplugin so BCV keeps gating public API. The two AGP opt-outs (builtInKotlin=false,newDsl=false) are coupled to this decision — revisit when either upstream issue lands. Flipping them later is consumer-invisible: samekotlincoutput, samelib.api.Consumer impact
kotlin-stdlibfloor on the classpath rising from 1.9.x → 2.0.x. JVM target / JDK floor changes live in the stackedtarget-jvm-11PR.$$serializercompanions — they flip tosyntheticwithfinalmethods under language-2.0. No human-authored API moved.Json.encodeToString(...),Foo.serializer()and friends behave identically. Only theoretically affected: anyone subclassing an auto-generated$$serializer(not a supported kotlinx-serialization pattern).Test plan
./gradlew :lib:clean :lib:test :lib:detekt :lib:lintRelease :lib:apiCheck :lib:assembleRelease— greenInteropTest(Java consumer test) — all cases pass./gradlew assembleDebugfromsamples/MobileBuyIntegration/— greenTest plan
./gradlew :lib:clean :lib:test :lib:detekt :lib:lintRelease :lib:apiCheck :lib:assembleRelease— greenInteropTest(Java consumer test) — all cases pass./gradlew assembleDebugfromsamples/MobileBuyIntegration/— greenTest plan
./gradlew :lib:clean :lib:test :lib:detekt :lib:lintRelease :lib:apiCheck :lib:assembleReleasepasses locally.InteropTestpasses (consumer-facing Java interop intact).:lib:apiCheckstill gates public-API drift againstlib/api/lib.api.Before you merge
Important
platforms/swift/README.mdand/orplatforms/android/README.md)Releasing a new Swift version?
platforms/swift/ShopifyCheckoutKit.podspecplatforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swiftplatforms/swift/CHANGELOG.mdplatforms/swift/README.md(major version only)Releasing a new Android version?
versionNameinplatforms/android/lib/build.gradleplatforms/android/CHANGELOG.mdplatforms/android/README.mdTip
See the Contributing documentation for the full release process per platform.