首页 > 其他分享 >Idea android应用kotlin-stdlib-1.8.20 kotlin-stdlib-jdk81.6.21冲突

Idea android应用kotlin-stdlib-1.8.20 kotlin-stdlib-jdk81.6.21冲突

时间:2024-10-12 09:43:22浏览次数:7  
标签:20 21 kotlin 1.8 stdlib org

Idea android应用kotlin-stdlib-1.8.20 kotlin-stdlib-jdk81.6.21冲突

idea中开发android应用,安装android插件后,新建项目,然后各种包更新,最后运行时提示kotlin-stdlib-1.8.20 kotlin-stdlib-jdk8:1.6.21 冲突 错误如下:

FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21) Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations$ReflectSdkVersion found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21) Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations$ReflectSdkVersion found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.io.path.ExperimentalPathApi found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21) Duplicate class kotlin.io.path.PathRelativizer found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21) Duplicate class kotlin.io.path.PathsKt found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-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 jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-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 jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21) Duplicate class kotlin.jdk7.AutoCloseableKt found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21) Duplicate class kotlin.jvm.jdk8.JvmRepeatableKt found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.random.jdk8.PlatformThreadLocalRandom found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.streams.jdk8.StreamsKt found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$1 found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$2 found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$3 found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$4 found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.text.jdk8.RegexExtensionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21) Duplicate class kotlin.time.jdk8.DurationConversionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
 Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

查询各种资料,后通过如下方式解决 app下面的 build.gradle文件中添加两行指定kotlin-stdlib版本

dependencies {

    implementation("androidx.appcompat:appcompat:1.6.1")
    implementation("com.google.android.material:material:1.9.0")
    implementation("androidx.constraintlayout:constraintlayout:2.1.4")
    implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.1")
    implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1")
    implementation("androidx.navigation:navigation-fragment:2.6.0")
    implementation("androidx.navigation:navigation-ui:2.6.0")
    testImplementation("junit:junit:4.13.2")
    androidTestImplementation("androidx.test.ext:junit:1.1.5")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")

    // 解决kotlin-stdlib-1.8.20 kotlin-stdlib-jdk8:1.6.21 冲突
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.20")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20")
}
// 解决kotlin-stdlib-1.8.20 kotlin-stdlib-jdk8:1.6.21 冲突
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.20")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20")

标签:20,21,kotlin,1.8,stdlib,org
From: https://www.cnblogs.com/DevMuYuer/p/18459870

相关文章

  • 2024.10.11(自定义异常)
    自定义异常当程序中出现了某些“错误”,但该错误信息并没有在Throwable子类中描述处理,这个时候可以自己设计异常类,用于描述该错误信息。自定义异常的步骤定义类:自定义异常类名(程序员自己写)继承Exception或RuntimeException如果继承Exception,属于编译异常如果继承RuntimeExc......
  • 【2024-10-11】传承运动
    20:00人生易老天难老,岁岁重阳。今又重阳,战地黄花分外香。一年一度秋风劲,不似春光。胜似春光,寥廓江天万里霜。                                                 ——《采......
  • 2024.10.8(生成算数)
    importjavax.swing.;importjava.awt.;importjava.util.HashMap;importjava.util.HashSet;importjava.util.Random;publicclassMathQuizAppextendsJFrame{privatestaticfinalintQUIZ_TIME=3*60;//3privatestaticfinalintQUESTION_COUNT=40;/......
  • 2024.10.10
    Static当方法中不涉及到任何和对象相关的成员,则可以将方法设计成静态方法,提高开发效率,如:Math.sqrt()静态方法,只能访问静态的成员,非静态的方法,可以访问静态成员和非静态成员(必须遵守访问权限)注意这个的意思是静态方法不可以使用this访问本类的成员,但可以在静态方法内创建本......
  • 2024.10.7(数据结构的栈)
    顺序栈是利用顺序存储结构实现的栈,指针top指示栈顶在顺序栈的位置。base为存储空间基地址,S.top-S.base是栈中元素的个数,类似Length。栈为空时:S.topS.base;栈满时:S.top-S.baseMAXSIZE;顺序栈,top在最高元素的上一个,base位置是最低元素,故取栈顶元素要取top-1的:队列先进先出。......
  • 200号资源-源程序:(SCI论文+程序)使用多描述编码的状态估计外包传输网络------已提供下载
    ......
  • 文件管理方案参考 2024.10.12
    文件管理方案参考2024.10.12说明:此文档中的文件是指手机、平板电脑、笔记本电脑等电子设备在使用过程中新建、接收、重命名、移动、编辑的电子文件。例如:Word文档(.docx)、Excel表格(.xlsx)、Photoshop图片(.jpg)、酷我音乐盒无损音乐歌曲(.flac)、国语中字电影视频(.MP4)、视频教程(.AVI)。......
  • CSP2024-25
    2A题意(gym105158C):给定正整数序列\(\{a\}\),构造一个\(\mathbbZ\to\mathbbZ\)的映射\(f\),满足\(\foralli<n,\f(a_{i})\lef(a_{i+1})\)。最小化\(f(x)\nex\)的\(x\)数量。数据范围:\(1\len\le10^6,\1\lea_i\len\)。对于\(i\notin\{......
  • 2023 Benelux Algorithm Programming Contest (BAPC 23)
    A-\texttt题意\(n\)个软件包,已知大小,可以同时下载\(k\)个,已经下载好了\(m\)个,选\(k\)个下载使得下载完后进度最大,输出已完成进度所占百分比。思路选最大的\(m+k\)个。代码点击查看代码#include<bits/stdc++.h>usingnamespacestd;#defineintlonglongvoid......
  • 微软发布Windows 11 2024更新,新型Copilot+ AI PC功能亮相
    前言微软在Windows11的2024更新中加强了对人工智能的应用,推出了新功能Copilot+。此次更新的版本号为26100.1742,Copilot+将首先在WindowsInsider中推出,计划于11月向特定设备和市场推广,用户需开启“尽快获取最新更新”选项以接收此更新。系统获取https://pan.xunlei.com......