Alternatively, you can set dependencies at the top level.
Dependency on the standard library
A dependency on a standard library (
stdlib) in each source set is added automatically. The version of the standard library is the same as the version of the
For platform-specific source sets, the corresponding platform-specific variant of the library is used, while a common standard library is added to the rest. The Kotlin Gradle plugin will select the appropriate JVM standard library depending on the
kotlinOptions.jvmTarget compiler option of your Gradle build script
Learn how to change the default behavior.
Set dependencies on test libraries
If you didn’t use the Project Wizard to create your project, you can add the dependencies manually.
Set a dependency on a kotlinx library
If you use a kotlinx library and need a platform-specific dependency, you can use platform-specific variants of libraries with suffixes such as
-js, for example,
kotlinx-coroutines-core-jvm. You can also use the library base artifact name instead –
If you use a multiplatform library and need to depend on the shared code, set the dependency only once in the shared source set. Use the library base artifact name, such as