目前,我无法在 Xcode(M1 芯片)中部署和编译我的 kmm 项目,出现以下错误:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'embedAndSignAppleFrameworkForXcode' not found in project ':shared'.
* Try:
Run gradlew tasks to get a list of available tasks. 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 467ms
Command PhaseScriptExecution failed with a nonzero exit code
但是当我使用Rosetta模式时,它会成功,这个问题的原因是什么,我该如何一劳永逸地解决它?
这是我的build.gradle内容的一部分:</p>
build.gradle(android part)>>>
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
buildFeatures {
viewBinding = true
dataBinding = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
我的jdk是Amazon Corretto 17
build.gradle(共享部分) kotlin { android()
val iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget = when { System.getenv("SDK_NAME")?.startsWith("iphoneos") == true -> ::iosArm64 else -> ::iosX64 } iosTarget("ios") { binaries { framework { baseName = "kmm_shared" } } } targets.withType<KotlinNativeTarget> { compilations.get("main").kotlinOptions.freeCompilerArgs += "-Xexport-kdoc" compilations.get("main").kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.time.ExperimentalTime" } sourceSets { val commonMain by getting { kotlin.srcDir("$buildDir/generated-apis/src/commonMain/kotlin") dependencies { with(Deps.Supernaturals) { implementation(kotlinFs) } with(Deps.Ktor) { api(clientCore) api(clientJson) api(clientSerialization) } with(Deps.Kotlinx) { implementation(coroutinesCore) implementation(serializationCore) implementation(dateTime) } } } val commonTest by getting { dependencies { with(Deps.TestCommon) { implementation(kotlin(testCommon)) implementation(kotlin(testAnnotationsCommon)) } with(Deps.Mockk) { implementation(mockkCommon) } } } val androidMain by getting { dependencies { with(Deps.Ktor) { implementation(clientCio) } } } val androidTest by getting { dependencies { with(Deps.Junit) { implementation(kotlin(testJunit)) implementation(junit) } with(Deps.Mockk) { implementation(mockk) } with(Deps.Kotlinx) { implementation(coroutinesTest) } } } val iosMain by getting { dependencies { with(Deps.Ktor) { api(clientIos) } } } val iosTest by getting } }