Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kotlin Multiplatform: Execution failed for task ':shared:linkDebugFrameworkIosSimulatorArm64' [duplicate]

When trying to build a Kotlin Multiplatform App for iOS (from both Xcode and Android Studio), an error returns regarding the linkDebugFramework and the PhaseScriptExecution run script.

This stacktrace is output:

> Task :shared:linkDebugFrameworkIosSimulatorArm64 FAILED
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors

The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
ld: unknown options: -ios_simulator_version_min -sdk_version 
error: Compilation finished with errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared:linkDebugFrameworkIosSimulatorArm64'.
> Compilation finished with errors

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 13s
2 actionable tasks: 1 executed, 1 up-to-date

** BUILD FAILED **


The following build commands failed:
    PhaseScriptExecution Run\ Script /Users/[user]/Desktop/[app]/build/ios/[app-name].build/Debug-iphonesimulator/[app-name].build/Script-7555FFB5242A651A00829871.sh (in target '[app-name]' from project '[app-name]')
(1 failure)

So far, I have tried:

  • Setting xcodebuild command line version
  • clearing iOS build folder
  • reinstalling xcode and android studio
  • clearing gradle cache, rebuilding gradle

What worked for me was updating my build.gradle.kts to include:

id("com.android.application").version("8.1.0").apply(false)
    id("com.android.library").version("8.1.0").apply(false)
    id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin").version("2.0.1").apply(false)
    kotlin("android").version("1.9.10").apply(false)
    kotlin("multiplatform").version("1.9.10").apply(false)
    kotlin("plugin.serialization").version("1.9.10").apply(false)

Downgrading xcode did not work.

like image 457
hokobaro Avatar asked May 24 '26 13:05

hokobaro


1 Answers

You're probably using Xcode 15 and an older version of Kotlin. If on Xcode 15, bump Kotlin to 1.9.10. Alternatively, install Xcode 14.3.1.

Same issue here: https://stackoverflow.com/a/77150623/227313

:)

like image 145
Kevin Galligan Avatar answered May 26 '26 01:05

Kevin Galligan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!