I have a multiplatform library but i want it to t...
# multiplatform
s
I have a multiplatform library but i want it to target to lower version of kotlin 1.6.10. I am unable to generate a build for my library for native ios devices. Here is my build file can anone help and tell what m i doing wrong
Copy code
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework

plugins {
    kotlin("multiplatform")
    id("com.android.library")
    //kotlin("native.cocoapods")
    id("maven-publish")
    //id("com.chromaticnoise.multiplatform-swiftpackage") version "2.0.3"
}

kotlin {
    android {
        compilations.all {
            kotlinOptions {
                jvmTarget = "1.8"
            }
        }
    }

    val xcf = XCFramework()
    ios {
        binaries.framework {
            baseName = "shared"
            xcf.add(this)
            isStatic = true
        }
    }

    sourceSets {
        val commonMain by getting
        val commonTest by getting

        val iosMain by getting {
            dependsOn(commonMain)
        }
        val iosTest by getting {
            dependsOn(commonTest)
        }

        // You might not need these if you're only using iosMain for all iOS targets
        val iosX64Main by getting {
            dependsOn(iosMain)
        }
        val iosArm64Main by getting {
            dependsOn(iosMain)
        }
        val iosSimulatorArm64Main by creating {
            dependsOn(iosMain)
        }
    }
}

android {
    namespace = "com.shubhasai.myapplication"
    compileSdk = 34
    defaultConfig {
        minSdk = 24
    }
}
Here are the errors that i am getting
Copy code
FAILURE: Build completed with 5 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':shared:linkDebugFrameworkIosArm64'.
> Parameter specified as non-null is null: method org.jetbrains.kotlin.gradle.tasks.ExternalDependenciesBuilder.<init>, parameter compilation

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at <https://help.gradle.org>.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':shared:linkDebugFrameworkIosX64'.
> Parameter specified as non-null is null: method org.jetbrains.kotlin.gradle.tasks.ExternalDependenciesBuilder.<init>, parameter compilation

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at <https://help.gradle.org>.
==============================================================================

3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':shared:linkReleaseFrameworkIosX64'.
> Parameter specified as non-null is null: method org.jetbrains.kotlin.gradle.tasks.ExternalDependenciesBuilder.<init>, parameter compilation

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at <https://help.gradle.org>.
==============================================================================

4: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':shared:linkReleaseFrameworkIosArm64'.
> Parameter specified as non-null is null: method org.jetbrains.kotlin.gradle.tasks.ExternalDependenciesBuilder.<init>, parameter compilation

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at <https://help.gradle.org>.
==============================================================================

5: Task failed with an exception.
-----------
* What went wrong:
Configuration cache problems found in this build.
p
KMP and/or CMP are under heavy development. That means it is harder to guarantee backward/forward compatibility. Basically library versions are tied to specific kotlinlang and compose and gradle and other core lib versions. If you want to go back to 1.6.1, you certainly can but have to go back with all your dependencies and core libs too. Find the right match of each dependency and core lib and gradle plugins for 1.6
👍 1
s
When i am building the lib with higher version of kotlin then it wont be work with app with lower version of kotlin. i want to support at least 1.6.0
p
Yeah, unfortunately the binary compatibility is not guaranteed. You will have to compile the App with the same(or a compatible) version to the version that compiled the lib
🥲 1