Kotlinx.coroutines

Library support for Kotlin coroutines
Categoriesย >ย Control Flowย >ย Coroutine
Alternatives To Kotlinx.coroutines
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Kotlinx.coroutines12,2562325 days ago17July 25, 2023280apache-2.0Kotlin
Library support for Kotlin coroutines
Coil9,550403 days ago23May 21, 202331apache-2.0Kotlin
Image loading for Android backed by Kotlin Coroutines.
Compressor6,557
a year ago4March 22, 2021125Kotlin
An android image compression library.
Kotlin Coroutines And Flow Usecases On Android2,444
a month ago4apache-2.0Kotlin
๐ŸŽ“ Learning Kotlin Coroutines and Flows for Android by example. ๐Ÿš€ Sample implementations for real-world Android use cases. ๐Ÿ›  Unit tests included!
Splitties2,380
4 days ago9August 20, 202149apache-2.0Kotlin
A collection of hand-crafted extensions for your Kotlin projects.
Ktx1,25442 months ago38July 23, 20239cc0-1.0Kotlin
Kotlin extensions for the libGDX game framework
Paperplane1,138
5 years ago3apache-2.0Kotlin
๐Ÿ“š PaperPlane - An Android reading app, including articles from Zhihu Daily, Guokr Handpick and Douban Moment.
Flowbinding875137 months ago20July 04, 20216apache-2.0Kotlin
Kotlin Coroutines Flow binding APIs for Android's platform and unbundled UI widgets, inspired by RxBinding.
Kord770
a day ago18July 10, 202242mitKotlin
Idiomatic Kotlin Wrapper for The Discord API
Kotlin Coroutines Retrofit768
264 years ago20February 11, 20193apache-2.0Kotlin
Kotlin Coroutines await() extension for Retrofit Call
Alternatives To Kotlinx.coroutines
Select To Compare


Alternative Project Comparisons
Readme

kotlinx.coroutines

Kotlin Stable JetBrains official project GitHub license Download Kotlin Slack channel

Library support for Kotlin coroutines with multiplatform support. This is a companion version for the Kotlin 1.8.20 release.

suspend fun main() = coroutineScope {
    launch { 
       delay(1000)
       println("Kotlin Coroutines World!") 
    }
    println("Hello")
}

Play with coroutines online here

Modules

Documentation

Using in your projects

Maven

Add dependencies (you can also add other modules that you need):

<dependency>
    <groupId>org.jetbrains.kotlinx</groupId>
    <artifactId>kotlinx-coroutines-core</artifactId>
    <version>1.7.3</version>
</dependency>

And make sure that you use the latest Kotlin version:

<properties>
    <kotlin.version>1.8.20</kotlin.version>
</properties>

Gradle

Add dependencies (you can also add other modules that you need):

dependencies {
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
}

And make sure that you use the latest Kotlin version:

plugins {
    // For build.gradle.kts (Kotlin DSL)
    kotlin("jvm") version "1.8.20"
    
    // For build.gradle (Groovy DSL)
    id "org.jetbrains.kotlin.jvm" version "1.8.20"
}

Make sure that you have mavenCentral() in the list of repositories:

repositories {
    mavenCentral()
}

Android

Add kotlinx-coroutines-android module as a dependency when using kotlinx.coroutines on Android:

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")

This gives you access to the Android Dispatchers.Main coroutine dispatcher and also makes sure that in case of a crashed coroutine with an unhandled exception that this exception is logged before crashing the Android application, similarly to the way uncaught exceptions in threads are handled by the Android runtime.

R8 and ProGuard

R8 and ProGuard rules are bundled into the kotlinx-coroutines-android module. For more details see "Optimization" section for Android.

Avoiding including the debug infrastructure in the resulting APK

The kotlinx-coroutines-core artifact contains a resource file that is not required for the coroutines to operate normally and is only used by the debugger. To exclude it at no loss of functionality, add the following snippet to the android block in your Gradle file for the application subproject:

packagingOptions {
    resources.excludes += "DebugProbesKt.bin"
}

Multiplatform

Core modules of kotlinx.coroutines are also available for Kotlin/JS and Kotlin/Native.

In common code that should get compiled for different platforms, you can add a dependency to kotlinx-coroutines-core right to the commonMain source set:

commonMain {
    dependencies {
        implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
    }
}

No more additional dependencies are needed, platform-specific artifacts will be resolved automatically via Gradle metadata available since Gradle 5.3.

Platform-specific dependencies are recommended to be used only for non-multiplatform projects that are compiled only for target platform.

JS

Kotlin/JS version of kotlinx.coroutines is published as kotlinx-coroutines-core-js (follow the link to get the dependency declaration snippet) and as kotlinx-coroutines-core NPM package.

Native

Kotlin/Native version of kotlinx.coroutines is published as kotlinx-coroutines-core-$platform where $platform is the target Kotlin/Native platform. Targets are provided in accordance with official K/N target support.

Building and Contributing

See Contributing Guidelines.

Popular Coroutine Projects
Popular Kotlin Coroutines Projects
Popular Control Flow Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Kotlin
Gradle
Coroutines
Kotlin Coroutines