Skip to content

Conversation

@ovitrif
Copy link

@ovitrif ovitrif commented Jan 25, 2026

Summary

  • Upgrade Kotlin from 1.9.20 to 2.2.0 for compatibility with consuming apps using Kotlin 2.x
  • Upgrade kotlinx-serialization-json from 1.6.0 to 1.9.0 (required for Kotlin 2.2 compatibility)
  • Upgrade kotlinx-coroutines-core from 1.6.4 to 1.10.2
  • Upgrade atomicfu from 0.23.1 to 0.27.0
  • Add serialization support to JVM bindings for parity with Android

Problem

bitkit-android uses Kotlin 2.2.21, but ldk-node was using Kotlin 1.9.20 with kotlinx-serialization 1.6.0. This caused NoSuchMethodError when trying to serialize Event objects due to version incompatibility.

kotlinx-serialization 1.6.x is only compatible with Kotlin 1.9.x. For Kotlin 2.2.x, we need kotlinx-serialization 1.9.x.

Solution

Upgrade all Kotlin-related dependencies to versions compatible with Kotlin 2.2.x:

Dependency Before After
Kotlin 1.9.20 2.2.0
kotlinx-serialization-json 1.6.0 1.9.0
kotlinx-coroutines-core 1.6.4 1.10.2
atomicfu 0.23.1 0.27.0

JVM Bindings Updates

  • Added uniffi-jvm.toml config with generate_serializable_types = true and generate_immutable_records = true
  • Updated uniffi_bindgen_generate_kotlin.sh to use gobley-uniffi-bindgen (same as Android)
  • Added kotlinx-serialization-json and atomicfu dependencies to JVM build.gradle.kts
  • Updated Gradle wrapper to 8.0 (required for Kotlin 2.2.0)
  • Refactored JVM tests to use .copy() for immutable data class modifications

Files Changed

  • uniffi-jvm.toml (new) - JVM binding generation config
  • scripts/uniffi_bindgen_generate_kotlin.sh - Use gobley with config
  • bindings/kotlin/ldk-node-jvm/lib/build.gradle.kts - Dependencies update
  • bindings/kotlin/ldk-node-jvm/gradle/wrapper/gradle-wrapper.properties - Gradle 8.0
  • bindings/kotlin/ldk-node-jvm/lib/src/test/kotlin/.../LibraryTest.kt - Use .copy()
  • bindings/kotlin/ldk-node-android/build.gradle.kts - Kotlin 2.2.0
  • bindings/kotlin/ldk-node-android/lib/build.gradle.kts - Dependencies update

Test plan

  • Build Android bindings: cd bindings/kotlin/ldk-node-android && ./gradlew build
  • Build JVM bindings: cd bindings/kotlin/ldk-node-jvm && ./gradlew build -x test
  • Verify JVM bindings have 113 @Serializable annotations
  • Test in bitkit-android

Release

@ovitrif ovitrif force-pushed the feat/kotlin-serialization-update branch from 3b1dc8e to c5f5e10 Compare January 26, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants