KMM Cocoapods Export (M1) Mac

Viewed 1022

So i am trying to export my KMM project as iOS framework

here is my build.gradle.kts

kotlin {
   android()
   ios()
   sourceSets {
    val commonMain by getting {
        dependencies {
            implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.0-RC")
            implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.2.1")
            implementation("com.soywiz.korlibs.klock:klock:2.2.2")
            implementation("com.ionspin.kotlin:bignum:0.3.2")
        }
    }
    val commonTest by getting {
        dependencies {
            implementation(kotlin("test-common"))
            implementation(kotlin("test-annotations-common"))
        }
    }
    val androidMain by getting
    val androidTest by getting {
        dependencies {
            implementation(kotlin("test-junit"))
            implementation("junit:junit:4.13.2")
        }
    }

    val iosX64Main by getting
    val iosArm64Main by getting
    val iosMain by getting {
        dependsOn(commonMain)
        iosX64Main.dependsOn(this)
        iosArm64Main.dependsOn(this)
    }
    val iosTest by getting
}

cocoapods {
    framework {
        summary = "Some description for a Kotlin/Native module"
        homepage = "Link to a Kotlin/Native module homepage"
        baseName = "sharedCode"
        isStatic = false
        export(project(":sharedCode"))
        transitiveExport = true
    }
    podfile = project.file("/Users/user/Developments/SampleApp/Podfile")
    ios.deploymentTarget = "14.0"
}
}

here is my Podfile

platform :ios, '14.0'
use_frameworks!

target 'Sample App' do
pod 'sharedCode', :path => '/Users/User/Developments/KotlinMultiplatform/sharedCode'
end

Whenever i run the gradle sync from Android Studio it will throw this error

Executing of 'pod install' failed with code 1.
Error message:

Please, check that file "/Users/User/Developments/SampleApp/Podfile" contains following lines in header:
source 'https://cdn.cocoapods.org'

Please, check that each target depended on sharedCode contains following dependencies:

And then i tried to run the pod install command from my terminal and it successfully installed the cocoapods. however during build I encounter this another problem

* What went wrong:
Execution failed for task ':sharedCode:linkPodDebugFrameworkIosArm64'.

Following dependencies exported in the podDebugFramework binary are not specified as API-dependencies of a corresponding source set:

Project :sharedCode

Please add them in the API-dependencies and rerun the build.

What am I missing here? Thank you

1 Answers

i had the same issue. open terminal and run vim .zshrc. add LANG=en_US.UTF-8 then save it. This resolved problem for me.

Related