Add Stable Coroutines to Android-Kotlin Project
We will see, how can we add the latest stable version of Coroutines to Android project.
This article is a part of “Android Kotlin Coroutines: Basic Terminologies & Usage” article.
Updated (30 Oct 2018) for stable Kotlin plugin v1.3.
Note: Now onward, this post will not be updated unless required. So, it would be better if you add required dependencies from the official doc: https://github.com/Kotlin/kotlinx.coroutines
Here we are going see the steps involved in adding the stable version of Coroutines included in Kotlin v1.3.
Android Studio:
Step 1. Go to Tools → Kotlin → Configure Kotlin Plugin Updates, select “Stable” in the Update channel drop-down list, and then click Check for updates.
Step 2. Add following lines to your project level build.gradle
(As EAPs are not public we need to add private URL)
dependencies {
//...
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.0'
}
Step 3. Add following lines to your app/module level build.gradle
We are adding coroutines-core along with coroutines-android.
dependencies {
//...
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
}
Now, sync your project with gradle files and you are ready use the latest Coroutines.
Thanks for reading!
Rohit Surwase
If you liked the article, clap clap clap 👏👏👏 as many times as you can.
LIKED SO MUCH! Medium allows up to 50 claps.
Also, post a Tweet on Twitter.
Let’s be the friends on LinkedIn, Medium, Twitter and GitHub.