首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >冲突的jetified-kotlin-reflect依赖性

冲突的jetified-kotlin-reflect依赖性
EN

Stack Overflow用户
提问于 2019-01-22 19:57:20
回答 1查看 4.5K关注 0票数 12

当我构建我的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

但我不知道为什么jetified-kotlin-reflect会出现在其中,因为它不是依赖项,甚至不会出现在androidDependencies中。

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

EN

回答 1

Stack Overflow用户

发布于 2019-04-04 01:01:40

我猜如果你像使用类文字语法那样使用reflection features,kotlin插件会自动添加kotlin-relection.jar。

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

我修复了警告,显式添加了

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

到我的build.gradle。

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

https://stackoverflow.com/questions/54307822

复制
相关文章

相似问题

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