[英]KMM : How to resolve Incompatible abi version. The current default is '1.4.2', found '1.5.0'. The library produced by 1.5.20 compiler?
I am producing a KMM application
, I have already done the Android part without any problems, everything works perfectly.我正在制作一个
KMM application
,我已经完成了 Android 部分,没有任何问题,一切正常。
Nevertheless, when I launch the iOS version, by opening the iosMyApp.xcworkspace
file, and I launch the compilation, this error appears.然而,当我启动 iOS 版本时,通过打开
iosMyApp.xcworkspace
文件并启动编译,出现此错误。
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
w: skipping /Users/jeremieguillot/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-serialization-iosx64/1.6.3/1912839739c3051183691e878ef7e4d17366f4f4/ktor-client-serialization.klib. **Incompatible abi version. The current default is '1.4.2', found '1.5.0'. The library produced by 1.5.20 compiler**
e: Could not find "/Users/jeremieguillot/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-serialization-iosx64/1.6.3/1912839739c3051183691e878ef7e4d17366f4f4/ktor-client-serialization.klib" in [/Users/jeremieguillot/AndroidStudioProjects/SpotABivouac/iosSpotApp/Pods, /Users/jeremieguillot/.konan/klib, /Users/jeremieguillot/.konan/kotlin-native-prebuilt-macos-1.5.10/klib/common, /Users/jeremieguillot/.konan/kotlin-native-prebuilt-macos-1.5.10/klib/platform/ios_x64]
Daemon vm is shutting down... The daemon has exited normally or was terminated in response to a user interrupt.
----- End of the daemon log -----
FAILURE: Build failed with an exception.
* What went wrong:
Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)
* 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
> **Task :shared:compileKotlinIos**
**Command PhaseScriptExecution failed with a nonzero exit code**
Currently, I have nothing in the iOS part.目前,我在 iOS 部分没有任何内容。
Here is the configuration of my project.这是我的项目的配置。 build.gradle.kts (:shared)
build.gradle.kts (:shared)
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
kotlin("plugin.serialization") version "1.5.10"
}
version = "1.0"
kotlin {
android()
val iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true)
::iosArm64
else
::iosX64
iosTarget("ios") {}
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
ios.deploymentTarget = "15.0"
frameworkName = "shared"
podfile = project.file("../iosSpotApp/Podfile")
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.2.1")
implementation("io.ktor:ktor-client-core:1.6.3")
implementation("io.ktor:ktor-client-serialization:1.6.3")
implementation("com.russhwolf:multiplatform-settings-no-arg:0.7.7")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val androidMain by getting {
dependencies {
implementation("io.ktor:ktor-client-android:1.6.3")
}
}
val androidTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("junit:junit:4.13.2")
}
}
val iosMain by getting {
dependencies {
implementation("io.ktor:ktor-client-ios:1.6.3")
}
}
val iosTest by getting
}
}
android {
compileSdk = 31
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 23
targetSdk = 31
}
}
build.gradle.kts构建.gradle.kts
buildscript {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.1.0-alpha12")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10")
classpath("com.apollographql.apollo:apollo-gradle-plugin:2.5.9")
classpath("com.google.dagger:hilt-android-gradle-plugin:2.38.1")
}
}
allprojects {
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
}
}
tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}
I tried to modify this line for an older version but without success.我尝试将此行修改为旧版本,但没有成功。
implementation("io.ktor:ktor-client-ios:1.6.3")
Does anyone have a solution or anything to investigate?有没有人有解决方案或有什么需要调查的? 😊
😊
我能够通过将 Kotlin 从 1.5.10 更新到 1.5.20 来解决这个问题。
I have faced similar issue in the KMM project with iOS project.我在 iOS 项目的 KMM 项目中遇到了类似的问题。
Incompatible abi version.
abi 版本不兼容。 The current default is '1.5.0', found '1.6.0'.
当前默认为'1.5.0',找到'1.6.0'。 The library produced by 1.6.21 compiler ios
1.6.21编译器ios产生的库
I have resolved by upgrading gradle version in application gradle我已经通过在应用程序 gradle 中升级 gradle 版本来解决
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31")
replaced with
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
if still getting problem, upgrade kotlin gradle and kmm plugin in the plugins section如果仍然有问题,请在插件部分升级 kotlin gradle 和 kmm 插件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.