kotlin - 警告 : Kotlin runtime JAR files in the clas

我收到以下警告,但我不确定 v1.0.6 位于何处。

这个错误是否可能来自包含旧 Kotlin 版本的 Kotlin 库?

任何想法如何解决它,或者至少我可以如何按照建议明确 kotlin-reflect (1.1) ?

最佳答案

您的项目似乎配置为依赖于 kotlin-stdlib 1.1 和 kotlin-reflect 1.0。最可能的情况是您已经明确依赖于 kotlin-stdlib 1.1,但不依赖于 kotlin-reflect 和其他一些库(您所依赖的)依赖于 kotlin-reflect 1.0.

如果确实如此,解决方案是提供对 kotlin-reflect 1.1 的显式依赖。

在 Maven 中,将其添加到 pom.xml:

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-reflect</artifactId>
            <version>1.1.0</version>
        </dependency>
    </dependencies>

在 Gradle 中,将其添加到 build.gradle:

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-reflect:1.1.0"
}

查看有关此问题和相关警告的一些信息 in the official docs .

关于kotlin - 警告 : Kotlin runtime JAR files in the classpath should have the same version,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42569445/

相关文章:

kotlin - kotlin 中的 Dagger 2 静态提供程序方法

android - 当列名相同时,如何表示与 Android Room 的 "many to man

generics - 如何在 Kotlin 中获取泛型参数类

java - 如何在 Kotlin 中组合 Intent 标志

lambda - 引用 Kotlin 中特定实例的方法

android - 房间持久性 : Error:Entities and Pojos must ha

kotlin - Kotlin 协程中的挂起函数是什么意思?

android - 如何将 Kotlin 与 Proguard 一起使用

android-studio - Kotlin:为什么 Android Studio 中的大多数变量

enums - 如何在 Kotlin 中为枚举创建 "static"方法?