首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >未能解决Kotlin库io.ktor-ktor-客户端日志记录

未能解决Kotlin库io.ktor-ktor-客户端日志记录
EN

Stack Overflow用户
提问于 2021-09-12 11:31:57
回答 1查看 1.3K关注 0票数 0

我试图为Android和iOS编写一个简单的多平台库。我的依赖关系是:

代码语言:javascript
运行
复制
sourceSets {
    val commonMain by getting {
        dependencies {
            implementation("io.ktor:ktor-client-core:1.6.3")
            implementation("io.ktor:ktor-client-logging:1.6.3")
            implementation("io.ktor:ktor-client-serialization:1.6.3")     
            implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2")
        }
    }
    val commonTest by getting {
        dependencies {
            implementation(kotlin("test"))
        }
    }
    val androidMain by getting {
        dependencies {
            rootProject
            //implementation("com.google.android.material:material:1.4.0")
            implementation("io.ktor:ktor-client-okhttp:1.6.3")
        }
    }
    val androidTest by getting {
        dependencies {
            implementation("junit:junit:4.13")
        }
    }
    val iosArm64Main by getting {
        dependencies {
            implementation("io.ktor:ktor-client-ios:1.6.3")
        }
    }
    val iosArm64Test by getting
}

在构建时,我会收到以下错误:

代码语言:javascript
运行
复制
java.lang.IllegalStateException: e: Failed to resolve Kotlin library: /Users/????/IdeaProjects/????/build/kotlinSourceSetMetadata/commonMain/io.ktor-ktor-client-logging/io.ktor-ktor-client-logging-commonMain.klib

尽管我在build/kotlinSourceSetMetaData文件夹中看到了包。

当我在kotlin.mpp.enableGranularSourceSetsMetadata=false中设置gradle.properties时,错误更改为:

代码语言:javascript
运行
复制
    > Task :compileKotlinIosArm64
w: skipping /Users/????/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-logging-iosarm64/1.6.3/374d82df9cd22c5960ffc1eecc6ec45f3101031/ktor-client-logging.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/????/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-logging-iosarm64/1.6.3/374d82df9cd22c5960ffc1eecc6ec45f3101031/ktor-client-logging.klib" in [/Users/????/IdeaProjects/????, /Users/????/.konan/klib, /Users/????/.konan/kotlin-native-prebuilt-macos-1.5.10/klib/common, /Users/????/.konan/kotlin-native-prebuilt-macos-1.5.10/klib/platform/ios_arm64]
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-13 08:28:14

后一个错误建议您同步正在使用的Kotlin版本和Ktor版本。有关详细信息,请查看推荐的kotlinx库版本。您可能需要将Kotlin更改为1.5.30,或将Ktor 1.5.4降级。

请与下面的结果评论。如果还会有什么问题,我会更新这个答案。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69151011

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档