首页 > 基础资料 博客日记
【Android Studio插件升级以后kotlin jdk版本冲突】
2023-07-24 12:34:44基础资料围观945次
今天升级一些插件版本后无法编译,发现kotlin jdk 1.8.20和kotlin jdk 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 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 R e f l e c t S d k V e r s i o n f o u n d i n m o d u l e s k o t l i n − s t d l i b − 1.8.20 ( o r g . j e t b r a i n s . k o t l i n : k o t l i n − s t d l i b : 1.8.20 ) a n d k o t l i n − s t d l i b − j d k 7 − 1.6.21 ( o r g . j e t b r a i n s . k o t l i n : k o t l i n − s t d l i b − j d k 7 : 1.6.21 ) D u p l i c a t e c l a s s k o t l i n . i n t e r n a l . j d k 8. J D K 8 P l a t f o r m I m p l e m e n t a t i o n s f o u n d i n m o d u l e s k o t l i n − s t d l i b − 1.8.20 ( o r g . j e t b r a i n s . k o t l i n : k o t l i n − s t d l i b : 1.8.20 ) a n d k o t l i n − s t d l i b − j d k 8 − 1.6.21 ( o r g . j e t b r a i n s . k o t l i n : k o t l i n − s t d l i b − j d k 8 : 1.6.21 ) D u p l i c a t e c l a s s k o t l i n . i n t e r n a l . j d k 8. J D K 8 P l a t f o r m I m p l e m e n t a t i o n s 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 a s S e q u e n c e asSequence asSequence i n l i n e d inlined inlinedSequence 1 f o u n d i n m o d u l e s k o t l i n − s t d l i b − 1.8.20 ( o r g . j e t b r a i n s . k o t l i n : k o t l i n − s t d l i b : 1.8.20 ) a n d k o t l i n − s t d l i b − j d k 8 − 1.6.21 ( o r g . j e t b r a i n s . k o t l i n : k o t l i n − s t d l i b − j d k 8 : 1.6.21 ) D u p l i c a t e c l a s s k o t l i n . s t r e a m s . j d k 8. S t r e a m s K t 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 3 f o u n d i n m o d u l e s k o t l i n − s t d l i b − 1.8.20 ( o r g . j e t b r a i n s . k o t l i n : k o t l i n − s t d l i b : 1.8.20 ) a n d k o t l i n − s t d l i b − j d k 8 − 1.6.21 ( o r g . j e t b r a i n s . k o t l i n : k o t l i n − s t d l i b − j d k 8 : 1.6.21 ) D u p l i c a t e c l a s s k o t l i n . s t r e a m s . j d k 8. S t r e a m s K t 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$ i n l i n e d 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 <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
方案
build.gradle文件中修改kotlin-stdlib-jdk加载方式
// 插件升级后出现kotlin-stdlib-jdk版本冲突在这里解决
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.20")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20")
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:jacktools123@163.com进行投诉反馈,一经查实,立即删除!
标签: