KMP-NativeCoroutines icon indicating copy to clipboard operation
KMP-NativeCoroutines copied to clipboard

Gradle task kspKotlinIosSimulatorArm64 fails in 1.0.0-ALPHA-38

Open Saad-Mufti opened this issue 11 months ago • 10 comments

> Task :shared:kspKotlinIosSimulatorArm64 FAILED
Custom actions are attached to task ':shared:kspKotlinIosSimulatorArm64'.
Caching disabled for task ':shared:kspKotlinIosSimulatorArm64' because:
  Build cache is disabled
Task ':shared:kspKotlinIosSimulatorArm64' is not up-to-date because:
  Input property 'excludeOriginalPlatformLibraries$kotlin_gradle_plugin_common' file /Users/saad/.konan/kotlin-native-prebuilt-macos-aarch64-2.1.0/klib/platform/ios_simulator_arm64/org.jetbrains.kotlin.native.platform.CoreFoundation/default has been removed.
  Input property 'excludeOriginalPlatformLibraries$kotlin_gradle_plugin_common' file /Users/saad/.konan/kotlin-native-prebuilt-macos-aarch64-2.1.0/klib/platform/ios_simulator_arm64/org.jetbrains.kotlin.native.platform.CoreFoundation/default/linkdata has been removed.
  Input property 'excludeOriginalPlatformLibraries$kotlin_gradle_plugin_common' file /Users/saad/.konan/kotlin-native-prebuilt-macos-aarch64-2.1.0/klib/platform/ios_simulator_arm64/org.jetbrains.kotlin.native.platform.CoreFoundation/default/linkdata/module has been removed.
file or directory '/Users/saad/app/shared/src/appleMain/kotlin', not found
file or directory '/Users/saad/app/shared/src/nativeMain/kotlin', not found
file or directory '/Users/saad/app/shared/src/iosSimulatorArm64Main/kotlin', not found
file or directory '/Users/saad/app/shared/src/appleMain/kotlin', not found
file or directory '/Users/saad/app/shared/src/nativeMain/kotlin', not found
Can't find env_blacklist file at /Users/saad/.konan/kotlin-native-prebuilt-macos-x86_64-2.1.0/tools/env_blacklist.
error: org.jetbrains.kotlin.cli.utilities.MainKt

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared:kspKotlinIosSimulatorArm64'.
> java.lang.ClassNotFoundException: org.jetbrains.kotlin.cli.utilities.MainKt

I'm new to KMP-NativeCoroutines and am not sure if I'm doing something wrong here - above is the error excerpt from running ./gradlew :shared:embedAndSignAppleFrameworkForXcode --info as a build phase in my iOS app. Any help would be appreciated.

KMP-NativeCoroutines version: 1.0.0-ALPHA-38 KSP version: 2.1.0-1.0.29 MacOS version 15.2 (Sequoia), Apple M2 chip XCode Version 16.2 (16C5032a)

Saad-Mufti avatar Dec 17 '24 00:12 Saad-Mufti

Sounds like there is an issue with the ~/.konan directory similar to this issue.

Could you try to sync in IntelliJ/Android Studio and/or clearing the konan directory?

rickclephas avatar Dec 17 '24 19:12 rickclephas

I tried that, to no effect.

Saad-Mufti avatar Dec 18 '24 00:12 Saad-Mufti

I am having a similar issue where cocoapods doesn't recognize [1.0.0-ALPHA-38], only up to ALPHA-5 version, but when i reduce the plugin in Kotlin to ALPHA 5 i see a similar error for kotlin 2.1.0.

Does alpha-5 work for kotlin 2.1.0?

chromecountry avatar Jan 19 '25 20:01 chromecountry

@chromecountry no Kotlin 2.1.0 is only supported in 1.0.0-ALPHA-38

rickclephas avatar Jan 20 '25 18:01 rickclephas

@rickclephas when I add the following to my pod file:

  # Pods for iosApp
  pod 'KMPNativeCoroutinesAsync', '1.0.0-ALPHA-38'    # Swift Concurrency implementation
  pod 'KMPNativeCoroutinesCombine', '1.0.0-ALPHA-38'  # Combine implementation
  pod 'KMPNativeCoroutinesRxSwift', '1.0.0-ALPHA-38'  # RxSwift implementation

I get this error:

alex@anothergreenworld iosApp $ pod repo update
Updating spec repo `trunk`
{10:29:59}[/Users/alex/lab/training/kotlin/dogify/iosApp] =====================================(* master)
alex@anothergreenworld iosApp $ pod install
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "KMPNativeCoroutinesRxSwift":
  In Podfile:
    KMPNativeCoroutinesRxSwift (= 1.0.0-ALPHA-38)

None of your spec sources contain a spec satisfying the dependency: `KMPNativeCoroutinesRxSwift (= 1.0.0-ALPHA-38)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

[!] Automatically assigning platform `iOS` with version `16.0` on target `iosApp` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

When I check cocoapods.org I do not see ALPHA-38 available

chromecountry avatar Jan 20 '25 18:01 chromecountry

@chromecountry there is an issue with the RxSwift CocoaPods publication that I am looking into. If you don't need the RxSwift support you can just remove it. Otherwise you could try to use the Swift Package Manger for now.

rickclephas avatar Jan 20 '25 18:01 rickclephas

@rickclephas Thank you. It'd be simpler to not have to migrate away from cocoapods / kotlin 2.1 for my project. Do you have an ETA on when we can expect the CocoaPods publication to be fixed? I am ok to wait if this will only take a few days.

chromecountry avatar Jan 20 '25 19:01 chromecountry

@chromecountry no ETA, but hopefully soon.

rickclephas avatar Jan 21 '25 05:01 rickclephas

@chromecountry I am afraid a CocoaPods issue prevents the release of the RxSwift implementation (see https://github.com/CocoaPods/CocoaPods/issues/11839 and https://github.com/CocoaPods/CocoaPods/issues/12033).

As a workaround you can request CocoaPods to just get the spec from the repo instead:

pod 'KMPNativeCoroutinesRxSwift', git: 'https://github.com/rickclephas/KMP-NativeCoroutines.git', tag: 'v1.0.0-ALPHA-38'

rickclephas avatar Jan 24 '25 20:01 rickclephas

Just ran into the error mentioned in the original error above, here: https://github.com/Kotlin/KMP-App-Template-Native/pull/30

java.lang.ClassNotFoundException: org.jetbrains.kotlin.cli.utilities.MainKt

In my case it seems to be caused by https://youtrack.jetbrains.com/issue/KT-74278/KSP-tasks-dont-trigger-a-K-N-distribution-downloading

And a possible workaround is disabling native toolchains in gradle.properties until you get the fix for the above in 2.2.0-Beta1:

kotlin.native.toolchain.enabled=false

zsmb13 avatar Apr 13 '25 20:04 zsmb13