hello guys, please i need help with this. Whenever...
# multiplatform
s
hello guys, please i need help with this. Whenever i add the ktor dependency to the iosMain in my build.gradle.kts(:shared), the ios app fails to build but after removing it builds. This is the shared gradle:
Copy code
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
    dependsOn(commonMain)
    iosX64Main.dependsOn(this)
    iosArm64Main.dependsOn(this)
    iosSimulatorArm64Main.dependsOn(this)
    dependencies{
        implementation(Dep.Ktor.ios)
    }
}
And this is the error i get:
BUILD FAILED in 3s
7 actionable tasks: 2 executed, 5 up-to-date Command PhaseScriptExecution failed with a nonzero exit code * BUILD FAILED * The following build commands failed: PhaseScriptExecution [CP-User]\ Build\ shared /Users/tolusolomon/AndroidStudioProjects/Link/build/ios/Pods.build/Debug-iphonesimulator/shared.build/Script- (1 failure)
m
Can't you share whole project? I am missing error in what you posted. Check if you don't have more in logs ( sometimes I get more in XCode 🤷 ) Also why are you only adding KTor to iOS target? And only simulator if I understand correctly?
s
here is a link to the project: https://github.com/Toluxpersia/LinkM
i am adding Ktor to both android and Ios target. The ktot was added to the iosMain not only the simulator. And i hope this is a more comprehensive error report:
Could not connect to kotlin daemon. Using fallback strategy.
warning: ATTENTION! -XXLanguage:+DisableCompatibilityModeForNewInference This mode is not recommended for production use, as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk!
Task buildSrccompileJava NO-SOURCE
Task buildSrccompileGroovy NO-SOURCE
Task buildSrcpluginDescriptors UP-TO-DATE
Task buildSrcprocessResources NO-SOURCE
Task buildSrcclasses UP-TO-DATE
Task buildSrcinspectClassesForKotlinIC UP-TO-DATE
Task buildSrcjar UP-TO-DATE
Task buildSrcassemble UP-TO-DATE
Task buildSrccompileTestKotlin NO-SOURCE
Task buildSrcpluginUnderTestMetadata UP-TO-DATE
Task buildSrccompileTestJava NO-SOURCE
Task buildSrccompileTestGroovy NO-SOURCE
Task buildSrcprocessTestResources NO-SOURCE
Task buildSrctestClasses UP-TO-DATE
Task buildSrctest NO-SOURCE
Task buildSrcvalidatePlugins UP-TO-DATE
Task buildSrccheck UP-TO-DATE
Task buildSrcbuild UP-TO-DATE
Configure project :shared
Kotlin Multiplatform Projects are an Alpha feature. See: https://kotlinlang.org/docs/reference/evolution/components-stability.html. To hide this message, add 'kotlin.mpp.stability.nowarn=true' to the Gradle properties. The following Kotlin source sets were configured but not added to any Kotlin compilation: * androidAndroidTestRelease * androidTestFixtures * androidTestFixturesDebug * androidTestFixturesRelease You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'. See https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#connecting-source-sets
Task sharedcompileKotlinIosSimulatorArm64 FAILED
w: skipping /Users/tolusolomon/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-serialization-iossimulatorarm64/1.6.7/6dfc1d684ea824d6fb3894258f3d3c4e89d9d233/ktor-client-serialization.klib. Incompatible abi version. The current default is '1.5.0', found '1.6.0'. The library produced by 1.6.0 compiler e: Could not find "/Users/tolusolomon/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-serialization-iossimulatorarm64/1.6.7/6dfc1d684ea824d6fb3894258f3d3c4e89d9d233/ktor-client-serialization.klib" in [/Users/tolusolomon/AndroidStudioProjects/Link/iosLink/Pods, /Users/tolusolomon/.konan/klib, /Users/tolusolomon/.konan/kotlin-native-prebuilt-macos-aarch64-1.5.31/klib/common, /Users/tolusolomon/.konan/kotlin-native-prebuilt-macos-aarch64-1.5.31/klib/platform/ios_simulator_arm64] FAILURE: Build failed with an exception. * What went wrong: Execution failed for task 'sharedcompileKotlinIosSimulatorArm64'.
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 Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings BUILD FAILED in 2s 7 actionable tasks: 2 executed, 5 up-to-date * BUILD FAILED * The following build commands failed: PhaseScriptExecution [CP-User]\ Build\ shared /Users/tolusolomon/AndroidStudioProjects/Link/build/ios/Pods.build/Debug-iphonesimulator/shared.build/Script-882AF45D8B8C4938AC461F4FBA0FE197.sh (in target 'shared' from project 'Pods') (1 failure) Command PhaseScriptExecution failed with a nonzero exit code
r
The cause of the error is the following:
ktor-client-serialization.klib. Incompatible abi version. The current default is ‘1.5.0’, found ‘1.6.0’.
You are currently using Kotlin 1.5 with Ktor 1.6.7 (which uses Kotlin 1.6). To fix this you should either update to Kotlin 1.6 or downgrade Ktor to 1.6.5 (which uses Kotlin 1.5).
🙏 1
s
Thanks so much, worked like a charm.
👍🏻 1