Knowledge base
CodexGuild Knowledge Base

Kotlin 2.4: stable context parameters, K1 removal and toolchain requirements (2026)

as of Sep 7, 2026 · applies to kotlin >= 2.4.0 · canonical · codexguild.com/kb/kb-kotlin-2-4-changes-2026 · exported 2026-10-11
Canonical as of Sep 7, 2026

Kotlin 2.4: stable context parameters, K1 removal and toolchain requirements (2026)

Kotlin 2.4.20 is current (2.4.0 released 2026-06-03). Context parameters and explicit backing fields are stable, K1 is removed, minimum AGP is 8.5.2, kotlin-android is deprecated under AGP 9, and Native requires iOS 15.

Kotlin 2.4: current state and changes since 2.2

As of: 2026-10

Current versions

  • Kotlin 2.4.20 (tooling release, 2026-09-07) is the latest. 2.4.0 (language release) shipped 2026-06-03, and 2.4.10 (bug fix) on 2026-07-14.
  • 2.3.0 shipped 2025-12-16 and 2.2.0 on 2025-06-23.

Stable in 2.4 (an older model treats these as experimental)

  • Context parameters: context(logger: Logger) fun f() {}. Explicit context arguments and callable references are still experimental.
  • Explicit backing fields (experimental in 2.3):
val items: List<String>
    field = mutableListOf()
  • The @all meta-target and new defaulting rules for use-site annotation targets.
  • Stdlib: the Uuid API is stable, and isSorted(), isSortedDescending(), isSortedBy() and related functions were added.

Stable in 2.3

  • Nested type aliases.
  • Data-flow-based exhaustiveness for when.
  • return in expression bodies with an explicit return type.
  • kotlin.time.Clock and kotlin.time.Instant are stable. Prefer them over kotlinx.datetime.Instant / Clock for new code.
  • Added Uuid.generateV4(), Uuid.generateV7() and Uuid.parseOrNull().
  • The unused-return-value checker is experimental.

Experimental in 2.4

Collection literals ([1, 2, 3]), @IntroducedAt, and the map helpers getOrElseIfNull, getOrPutIfNull, getOrElseIfMissing and getOrPutIfMissing.

Removals and toolchain requirements

  • K1 is gone. -language-version=1.9 is no longer supported in 2.4, and 2.3 had already dropped 1.8/1.9 for non-JVM targets. Old compiler plugins that depend on K1 will not work.
  • Gradle 7.6.3-9.5.0 is supported in 2.4. The minimum AGP is 8.5.2 (it was 8.2.2 in 2.3). JVM bytecode targets go up to Java 26.
  • AGP 9: the kotlin-android plugin is deprecated with AGP 9.0.0+ (since 2.3). Android modules use AGP's built-in Kotlin, and KMP Android targets move to Google's com.android.kotlin.multiplatform.library plugin. Flutter 3.44+ asks apps to set android.builtInKotlin=true.
  • Kotlin/Native 2.4: minimum targets are iOS/tvOS 15.0, macOS 12.0 and watchOS 8.0. The CMS GC is the default. Swift export is Alpha, and Flow is exported as AsyncSequence.
  • Compose compiler flags: StrongSkipping and IntrinsicRemember are DeprecationLevel.ERROR (removed in 2.5.0). OptimizeNonSkippingGroups and PausableComposition are deprecated (removed in 2.6.0). Remove them from composeCompiler {} blocks.
  • -Xpartial-linkage is deprecated because partial linkage is always on. The Ant build is no longer supported.
  • Wasm incremental compilation is stable and on by default.

What to do now

  1. Set the Kotlin Gradle plugin to 2.4.20, with AGP >= 8.5.2 and Gradle <= 9.5.0.
  2. Replace private _backing property pairs with explicit backing fields where it simplifies code.
  3. Remove deprecated Compose compiler feature flags.
  4. On AGP 9, drop org.jetbrains.kotlin.android in favor of built-in Kotlin.
  5. Raise Apple deployment targets for KMP.

Sources