Howto use coroutines in M1.3


What is the right way to use coroutines under M1.3 (EAP)?
I am obviously missing some basic ingredience, because coroutine “hello-world”

fun main(args: Array<String>) {
     launch {

will not compile. launch and delay cannot be resolved.

The following are my kotlin related parts from build.gradle.kts

plugins {
    kotlin("jvm") version "1.3.0-rc-116"

apply {

kotlin {
    experimental {
        coroutines = Coroutines.ENABLE

dependencies {

tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "1.8"

I guess, the experimental part is no longer needed in 1.3.


You need to import launch and delay I believe. They are not keywords in the language, but rather functions defined in some package.


Unfortunately, they are not available as imports (launch will only autocomplete to javafx.application.Application.launch).
Other functions from the corouting package like suspendCoroutine are available, that is why I believe something is missing in the configuration (jvm specific intrinsics?).


You need to add a dependency on kotlinx.coroutines library, where these functions are declared.

The latest version of that library for Kotlin 1.3 is 0.27.0-eap13.

Note that the top-level launch and async functions are deprecated, you can find how to use them properly here:


Thank you. It works now.