You can use the Kotlin standard library (stdlib) and test library (kotlin.test) in Kotlin/Wasm out of the box. The version of these libraries is the same as the version of the kotlin-multiplatform plugin.
Other official Kotlin (kotlinx) and multiplatform libraries are not fully supported yet. You can try experimental versions of such libraries by adding the Kotlin experimental repository to your Gradle project.
You can use one of the following repositories to add Kotlin libraries to your project:
Maven Central for stdlib and kotlin.test libraries:
// build.gradle.kts
repositories {
mavenCentral()
}
Custom Maven repository for experimental Kotlin/Wasm artifacts:
// build.gradle.kts
repositories {
maven("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental")
}
Custom Maven repository for Compose Multiplatform dev artifacts:
// build.gradle.kts
repositories {
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev/")
}
Library |
Version |
Repository |
|---|---|---|
stdlib |
1.9.0 |
Maven Central |
kotlin-test |
1.9.0 |
Maven Central |
kotlinx-coroutines |
1.7.0-RC-wasm0 |
Custom for experimental Kotlin/Wasm artifacts |
Compose Multiplatform |
1.4.0-dev-wasm08 |
Custom for experimental Kotlin/Wasm artifacts |
kotlinx-serialization |
1.5.1-wasm0 |
Custom for experimental Kotlin/Wasm artifacts |
Ktor |
2.3.1-wasm0 |
Custom for experimental Kotlin/Wasm artifacts |
kotlinx-atomicfu |
0.20.2-wasm0 |
Custom for experimental Kotlin/Wasm artifacts |
kotlinx-collections-immutable |
0.4-wasm0 |
Custom for experimental Kotlin/Wasm artifacts |
kotlinx-datetime |
0.4.0-wasm0 |
Custom for experimental Kotlin/Wasm artifacts |
skiko |
0.0.7.61-wasm03 |
Custom for Compose Multiplatform dev artifacts |
To set a dependency on a library, such as kotlinx.serilization and kotlinx.coroutines, update your build.gradle.kts file:
// `build.gradle.kts`
repositories {
maven("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental")
}
kotlin {
sourceSets {
val wasmMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core-wasm:1.5.1-wasm0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-wasm:1.6.4-wasm0")
implementation("io.ktor:ktor-client-core-wasm:2.3.1-wasm0")
}
}
}
}
© 2010–2023 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/docs/wasm-libraries.html