KMM : 如何解决不兼容的 abi 版本。当前默认为“1.4.2”,找到“1.5.0”。 1.5.20编译器产生的库?
Posted
技术标签:
【中文标题】KMM : 如何解决不兼容的 abi 版本。当前默认为“1.4.2”,找到“1.5.0”。 1.5.20编译器产生的库?【英文标题】: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? 【发布时间】:2021-11-17 23:11:51 【问题描述】:我正在制作KMM application
,我已经完成了 android 部分,没有任何问题,一切正常。
然而,当我启动 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**
目前,我在 iOS 部分什么都没有。
这是我的项目的配置。 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
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)
我尝试为旧版本修改此行但没有成功。
implementation("io.ktor:ktor-client-ios:1.6.3")
有没有人有解决方案或有什么需要调查的? ????
【问题讨论】:
请尝试将plugin.serialization
插件的版本从1.5.10更改为1.5.30。
【参考方案1】:
我能够通过将 Kotlin 从 1.5.10 更新到 1.5.20 来解决这个问题。
【讨论】:
以上是关于KMM : 如何解决不兼容的 abi 版本。当前默认为“1.4.2”,找到“1.5.0”。 1.5.20编译器产生的库?的主要内容,如果未能解决你的问题,请参考以下文章
Firefox 13.0.1不兼容Adblock Plus,怎么解决?
不同 C/C++ 语言版本 + GNU 扩展的 ABI 兼容性