文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

【Android Studio插件升级以后kotlin jdk版本冲突】

2023-08-16 17:27

关注

Android Studio插件升级以后kotlin jdk版本冲突

今天升级一些插件版本后无法编译,发现kotlin jdk 1.8.20和kotlin jdk 1.6.21重复冲突,网上找了挺多方法都没生效,千回百转才解决,发出来希望可以帮助到同样报错的同学

报错

FAILURE: Build failed with an exception.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations ReflectSdkVersionfoundinmoduleskotlin−stdlib−1.8.20(org.jetbrains.kotlin:kotlin−stdlib:1.8.20)andkotlin−stdlib−jdk7−1.6.21(org.jetbrains.kotlin:kotlin−stdlib−jdk7:1.6.21)Duplicateclasskotlin.internal.jdk8.JDK8PlatformImplementationsfoundinmoduleskotlin−stdlib−1.8.20(org.jetbrains.kotlin:kotlin−stdlib:1.8.20)andkotlin−stdlib−jdk8−1.6.21(org.jetbrains.kotlin:kotlin−stdlib−jdk8:1.6.21)Duplicateclasskotlin.internal.jdk8.JDK8PlatformImplementations ReflectSdkVersion found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21) Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations ReflectSdkVersionfoundinmoduleskotlin−stdlib−1.8.20(org.jetbrains.kotlin:kotlin−stdlib:1.8.20)andkotlin−stdlib−jdk7−1.6.21(org.jetbrains.kotlin:kotlin−stdlib−jdk7:1.6.21)Duplicateclasskotlin.internal.jdk8.JDK8PlatformImplementationsfoundinmoduleskotlin−stdlib−1.8.20(org.jetbrains.kotlin:kotlin−stdlib:1.8.20)andkotlin−stdlib−jdk8−1.6.21(org.jetbrains.kotlin:kotlin−stdlib−jdk8:1.6.21)Duplicateclasskotlin.internal.jdk8.JDK8PlatformImplementationsReflectSdkVersion found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
Duplicate class kotlin.io.path.ExperimentalPathApi found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
Duplicate class kotlin.io.path.PathRelativizer found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
Duplicate class kotlin.io.path.PathsKt found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
Duplicate class kotlin.io.path.PathsKt__PathReadWriteKt found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
Duplicate class kotlin.io.path.PathsKt__PathUtilsKt found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
Duplicate class kotlin.jdk7.AutoCloseableKt found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
Duplicate class kotlin.jvm.jdk8.JvmRepeatableKt found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
Duplicate class kotlin.random.jdk8.PlatformThreadLocalRandom found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
Duplicate class kotlin.streams.jdk8.StreamsKt found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
Duplicate class kotlin.streams.jdk8.StreamsKt asSequence asSequence asSequence inlined inlined inlinedSequence 1foundinmoduleskotlin−stdlib−1.8.20(org.jetbrains.kotlin:kotlin−stdlib:1.8.20)andkotlin−stdlib−jdk8−1.6.21(org.jetbrains.kotlin:kotlin−stdlib−jdk8:1.6.21)Duplicateclasskotlin.streams.jdk8.StreamsKt 1 found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.streams.jdk8.StreamsKt 1foundinmoduleskotlin−stdlib−1.8.20(org.jetbrains.kotlin:kotlin−stdlib:1.8.20)andkotlin−stdlib−jdk8−1.6.21(org.jetbrains.kotlin:kotlin−stdlib−jdk8:1.6.21)Duplicateclasskotlin.streams.jdk8.StreamsKtasSequenceKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲Sequence$2 foun…inlined$Sequence 3foundinmoduleskotlin−stdlib−1.8.20(org.jetbrains.kotlin:kotlin−stdlib:1.8.20)andkotlin−stdlib−jdk8−1.6.21(org.jetbrains.kotlin:kotlin−stdlib−jdk8:1.6.21)Duplicateclasskotlin.streams.jdk8.StreamsKt 3 found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.streams.jdk8.StreamsKt 3foundinmoduleskotlin−stdlib−1.8.20(org.jetbrains.kotlin:kotlin−stdlib:1.8.20)andkotlin−stdlib−jdk8−1.6.21(org.jetbrains.kotlin:kotlin−stdlib−jdk8:1.6.21)Duplicateclasskotlin.streams.jdk8.StreamsKtasSequence$ inlined inlined inlinedSequence$4 found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
Duplicate class kotlin.text.jdk8.RegexExtensionsJDK8Kt found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
Duplicate class kotlin.time.jdk8.DurationConversionsJDK8Kt found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)

 Go to the documentation to learn how to Fix dependency resolution errors.

在这里插入图片描述

方案

build.gradle文件中修改kotlin-stdlib-jdk加载方式

![](https://img-blog.csdnimg.cn/b63eb0c0dd97489a8138ec1e43d944d9.png

// 插件升级后出现kotlin-stdlib-jdk版本冲突在这里解决    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.20")    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20")

来源地址:https://blog.csdn.net/LLCCQAQ/article/details/131120858

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     807人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     351人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     314人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     433人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     221人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-后端开发
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯