I read recently that Kotlin Coroutines 1.7 adds `<...
# multiplatform
h
I read recently that Kotlin Coroutines 1.7 adds
<http://Dispatchers.IO|Dispatchers.IO>
to Kotlin Native. Forgive me if this is a naive question, but does this mean we'll be able to use
<http://Dispatchers.IO|Dispatchers.IO>
in KMM? Or should I continue using something like https://kotlinlang.slack.com/archives/C3PQML5NU/p1667210309540439?thread_ts=1667204954.062779&amp;cid=C3PQML5NU?
r
Yes you’ll be able to use
<http://Dispatchers.IO|Dispatchers.IO>
in KMM (or any other KMP project that isn’t using the JS target).
d
...except if you're using Ktor because they haven't fixed broken compatibility with Coroutines 1.7 yet 💔
h
Oh? What's the issue? I guess it's this: https://github.com/ktorio/ktor/pull/3609
Since this morning, I've updated my app to Coroutines 1.7.1, and everything seems to be working. I'm not running into this issue: https://youtrack.jetbrains.com/issue/KTOR-5728, even in a release build. I'm building only for iOS and Android. Is there any reason I shouldn't go forward with this?
d
@humblehacker I'm not sure what you and I are doing differently; but the combo of Kotlin
1.8.21
, Coroutines
1.7.1
and Ktor
2.3.0
results in compile failure for me, as noted in the issue above. Perhaps we're simply using different parts of the API.
h
@darkmoon_uk My bad, I misunderstood and thought the above error applied to Android release builds. I am seeing the issue with iOS release builds.
m
Upgrading the Ktor client from 2.2.4 to 2.3.0 with Kotlin 1.8.21 and coroutines 1.7.1 leads to this for a desktop (macOS) release build:
Copy code
io.ktor.events.Events$HandlerRegistration: can't find referenced class kotlinx.coroutines.internal.LockFreeLinkedListNode$AddLastDesc
io.ktor.events.Events$HandlerRegistration: can't find referenced class kotlinx.coroutines.internal.LockFreeLinkedListNode$RemoveFirstDesc

there were 2 unresolved references to classes or interfaces.

         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (<https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedclass>)
Unexpected error
java.io.IOException: Please correct the above warnings first.
	at proguard.Initializer.execute(Initializer.java:544) ~[proguard-base-7.2.2.jar:7.2.2]
	at proguard.pass.PassRunner.run(PassRunner.java:24) ~[proguard-base-7.2.2.jar:7.2.2]
	at proguard.ProGuard.initialize(ProGuard.java:328) ~[proguard-base-7.2.2.jar:7.2.2]
	at proguard.ProGuard.execute(ProGuard.java:130) ~[proguard-base-7.2.2.jar:7.2.2]
	at proguard.ProGuard.main(ProGuard.java:623) [proguard-base-7.2.2.jar:7.2.2]

> Task :desktopApp:proguardReleaseJars FAILED
With Ktor client 2.24 this worked perfectly with Kotlin 1.8.21 and coroutines 1.7.1.