Kotlinx.coroutines: NoClassDefFoundError: kotlinx.coroutines.android.HandlerContextKt

Created on 5 Nov 2018  路  7Comments  路  Source: Kotlin/kotlinx.coroutines

After update kotlin version to 1.3.0.I add follow to gradle:

    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.0'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
    implementation "org.jetbrains.anko:anko:$anko_version"

but in runtime,throw exception:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.konka.remoteservice, PID: 30643
    java.lang.NoClassDefFoundError: kotlinx.coroutines.android.HandlerContextKt
        at org.jetbrains.anko.sdk27.coroutines.Sdk27CoroutinesListenersWithCoroutinesKt.onClick$default(ListenersWithCoroutines.kt:293)
        at com.konka.remoteservice.activity.MainActivity.onCreate(MainActivity.kt:33)
        at android.app.Activity.performCreate(Activity.java:5288)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
        at android.app.ActivityThread.access$800(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5001)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
        at dalvik.system.NativeStart.main(Native Method)

Most helpful comment

I just tested it out. The new Anko 1.0.8 works with Kotlin 1.3 and coroutines 1.0.0

All 7 comments

I already update the IDE kotlin plugin to 1.3.But not work

Hi, it's probably because you are using Anko version which depends on Kotlin 1.2 and old kotlinx.coroutines.

Current companion version for Kotlin 1.3 is 0.10.7-eap13.
We will release new version of Anko soon

FYI I also received this error when using Kotlin 1.3, kotlinx coroutines '1.0.0' with Anko '0.10.7-rc13'.. if I downgrade kotlinx coroutines to '0.30.2-eap13', I no longer see this error...

I just tested it out. The new Anko 1.0.8 works with Kotlin 1.3 and coroutines 1.0.0

project works now with kotlin version 1.3.50 and with anko version 0.10.8

project works with anko:anko:0.10.8, kotlinOptions -> apiVersion = '1.3', kotlin_version = '1.4.10'

project work:
anko:anko:0.10.8,
kotlinOptions -> apiVersion = '1.2' or '1.3',
kotlin_version = '1.4.10'

Was this page helpful?
0 / 5 - 0 ratings