冲突的喷气式kotlin反映了依赖性



当我构建我的Android项目时,我得到以下消息:

w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
/home/janek/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.3.10/4d147bf43060dc43d61b096e24da1e67dfe0c032/kotlin-stdlib-jdk7-1.3.10.jar (version 1.3)
/home/janek/.gradle/caches/transforms-1/files-1.1/kotlin-reflect-1.0.6.jar/beba9d201a205f30041b70982540014d/jetified-kotlin-reflect-1.0.6.jar (version 1.0)
/home/janek/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.11/4cbc5922a54376018307a731162ccaf3ef851a39/kotlin-stdlib-1.3.11.jar (version 1.3)
/home/janek/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.11/d8b8e746e279f1c4f5e08bc14a96b82e6bb1de02/kotlin-stdlib-common-1.3.11.jar (version 1.3)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath

但我不知道为什么喷射的kotlin反射甚至在那里,因为它不是依赖项,甚至没有出现在androidDependencies中。

你知道它是从哪里来的吗?或者我如何解决这个错误?

如果您使用class literal语法等反射功能,我猜kotlin插件将自动添加kotlin relfection.jar

在Java平台上,使用反射功能所需的运行时组件作为一个单独的JAR文件(kotlin-reflect.JAR)进行分发。这样做是为了减少不使用反射功能的应用程序所需运行时库的大小。如果您确实使用了反射,请确保.jar文件已添加到项目的类路径中。

我通过显式添加修复了警告

implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

到我的大楼。雷达。

最新更新