因此,我试图将我的KMM项目导出为iOS框架。
这是我的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"
}
}这是我的个人档案
platform :ios, '14.0'
use_frameworks!
target 'Sample App' do
pod 'sharedCode', :path => '/Users/User/Developments/KotlinMultiplatform/sharedCode'
end每当我从Android运行gradle同步时,它都会抛出此错误
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:然后我尝试从我的终端运行pod install命令,它成功地安装了cocoapods。然而,在构建过程中,我遇到了另一个问题
* What went wrong:
Execution failed for task ':sharedCode:linkPodDebugFrameworkIosArm64'.在podDebugFramework二进制文件中导出的依赖项未指定为对应源集的API依赖项:
Project :sharedCode
Please add them in the API-dependencies and rerun the build.我在这里错过了什么?谢谢
发布于 2021-12-05 21:16:14
我也有过同样的问题。打开终端并运行vim .zshrc。添加LANG=en_US.UTF-8,然后保存它。这解决了我的问题。
https://stackoverflow.com/questions/69402134
复制相似问题