在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Kotlin/kotlinx.coroutines开源软件地址(OpenSource Url):https://github.com/Kotlin/kotlinx.coroutines开源编程语言(OpenSource Language):Kotlin 99.0%开源软件介绍(OpenSource Introduction):kotlinx.coroutinesLibrary support for Kotlin coroutines with multiplatform support.
This is a companion version for the Kotlin suspend fun main() = coroutineScope {
launch {
delay(1000)
println("Kotlin Coroutines World!")
}
println("Hello")
}
Modules
Documentation
Using in your projectsMavenAdd dependencies (you can also add other modules that you need): <dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<version>1.6.4</version>
</dependency> And make sure that you use the latest Kotlin version: <properties>
<kotlin.version>1.6.21</kotlin.version>
</properties> GradleAdd dependencies (you can also add other modules that you need): dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
} And make sure that you use the latest Kotlin version: plugins {
// For build.gradle.kts (Kotlin DSL)
kotlin("jvm") version "1.6.21"
// For build.gradle (Groovy DSL)
id "org.jetbrains.kotlin.jvm" version "1.6.21"
} Make sure that you have repositories {
mavenCentral()
} AndroidAdd implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") 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 ProGuardR8 and ProGuard rules are bundled into the Avoiding including the debug infrastructure in the resulting APKThe packagingOptions {
resources.excludes += "DebugProbesKt.bin"
} MultiplatformCore modules of In common code that should get compiled for different platforms, you can add a dependency to commonMain {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
}
} 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. JSKotlin/JS version of NativeKotlin/Native version of Building and Contributing |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论