falcon4ever / KMM-demos

KMM experiments
Apache License 2.0
12 stars 0 forks source link

iOS builds are broken in Android Studio after upgrading system to macOS Monterey, Android Studio Bumblebee and XCode 13.1 #2

Closed falcon4ever closed 2 years ago

falcon4ever commented 2 years ago

Seems like building iOS via Android Studio (Bumblebee) no longer works:

Decompose example:

MVIKotlin example:

falcon4ever commented 2 years ago

The iOS app not launching via Android Studio only happens on bumblebee, the latest android studio stable (Arctic fox) works fine.

The MVI kotlin example currently crashes with:

Function doesn't have or inherit @Throws annotation and thus exception isn't propagated from Kotlin to Objective-C/Swift as NSError.
It is considered unexpected and unhandled instead. Program will be terminated.
Uncaught Kotlin exception: kotlin.Error: Ktor native HttpClient requires kotlinx.coroutines version with `native-mt` suffix (like `1.3.9-native-mt`). Consider checking the dependencies.
    at 0   shared                              0x000000010b5add51 kfun:kotlin.Throwable#<init>(kotlin.String?){} + 97 (/opt/buildAgent/work/c5a36d4d82b914cf/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Throwable.kt:24:56)
    at 1   shared                              0x000000010b5a703d kfun:kotlin.Error#<init>(kotlin.String?){} + 93 (/opt/buildAgent/work/c5a36d4d82b914cf/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:12:58)
    at 2   shared                              0x000000010ba76970 kfun:io.ktor.client.utils#checkCoroutinesVersion(){} + 464 (/Users/administrator/Documents/agent/work/49d4a482a8522285/ktor-client/ktor-client-core/posix/src/io/ktor/client/utils/CoroutineUtilsPosix.kt:29:15)
    at 3   shared                              0x000000010ba17175 kfun:io.ktor.client.HttpClient#<init>(io.ktor.client.engine.HttpClientEngine;io.ktor.client.HttpClientConfig<out|io.ktor.client.engine.HttpClientEngineConfig>){} + 3125 (/Users/administrator/Documents/agent/work/49d4a482a8522285/ktor-client/ktor-client-core/common/src/io/ktor/client/HttpClient.kt:135:9)
    at 4   shared                              0x000000010ba17fc5 kfun:io.ktor.client.HttpClient#<init>(io.ktor.client.engine.HttpClientEngine;io.ktor.client.HttpClientConfig<out|io.ktor.client.engine.HttpClientEngineConfig>;kotlin.Boolean){} + 133 (/Users/administrator/Documents/agent/work/49d4a482a8522285/ktor-client/ktor-client-core/common/src/io/ktor/client/HttpClient.kt:83:6)
    at 5   shared                              0x000000010ba16206 kfun:io.ktor.client#HttpClient(io.ktor.client.engine.HttpClientEngineFactory<0:0>;kotlin.Function1<io.ktor.client.HttpClientConfig<0:0>,kotlin.Unit>){0§<io.ktor.client.engine.HttpClientEngineConfig>}io.ktor.client.HttpClient + 822 (/Users/administrator/Documents/agent/work/49d4a482a8522285/ktor-client/ktor-client-core/common/src/io/ktor/client/HttpClient.kt:43:18)
    at 6   shared                              0x000000010ba74ace kfun:io.ktor.client#HttpClient(kotlin.Function1<io.ktor.client.HttpClientConfig<*>,kotlin.Unit>){}io.ktor.client.HttpClient + 478 (/Users/administrator/Documents/agent/work/49d4a482a8522285/ktor-client/ktor-client-core/posix/src/io/ktor/client/HttpClient.kt:18:46)
    at 7   shared                              0x000000010b558ecb kfun:com.epicwindmill.mvikotlindecomposekmmsample.api.QuotesApi#<init>(){} + 187 (/Users/lmuller/KMM-demos/MVIKotlinDecomposeKmmSample/shared/src/commonMain/kotlin/com/epicwindmill/mvikotlindecomposekmmsample/api/SwansonQuotesApi.kt:10:30)
    at 8   shared                              0x000000010b55ba36 kfun:com.epicwindmill.mvikotlindecomposekmmsample.api.SwansonQuotes#<init>(){} + 150 (/Users/lmuller/KMM-demos/MVIKotlinDecomposeKmmSample/shared/src/commonMain/kotlin/com/epicwindmill/mvikotlindecomposekmmsample/api/SwansonQuotesApi.kt:30:23)

Function doesn't have or inherit @Throws annotation and thus exception isn't propagated from Kotlin to Objective-C/Swift as NSError. It is considered unexpected and unhandled instead. Program will be terminated. Uncaught Kotlin exception: kotlin.Error: Ktor native HttpClient requires kotlinx.coroutines version with native-mt suffix (like 1.3.9-native-mt). Consider checking the dependencies.

Which is weird since we did add a @Throws annotation and we do use the native-mt version of coroutines

falcon4ever commented 2 years ago

Force the coroutines with this -> https://github.com/falcon4ever/KMM-demos/blob/main/MVIKotlinDecomposeKmmSample/build.gradle.kts#L31

And now it works fine with Android Studio Arctic Fox 2020.3.1 Patch 3 / XCode 13.1 (Launches correctly from Android Studio)