5
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.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20)
     Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
     Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations$ReflectSdkVersion found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
aSemy
  • 5,485
  • 2
  • 25
  • 51
Sumit Ojha
  • 283
  • 2
  • 8
  • 2
    I guess you're importing kotlin 1.7.20 and 1.8. You probably have to double check the dependencies tree https://stackoverflow.com/questions/21645071/using-gradle-to-find-dependency-tree making sure that you only use one kotlin version – Lino Jan 28 '23 at 07:19
  • id 'org.jetbrains.kotlin.android' version '1.8.0' apply false – Sumit Ojha Jan 28 '23 at 07:28
  • https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7 – Lino Jan 29 '23 at 13:16
  • 1
    See https://stackoverflow.com/a/75322799/9585130 – Binh Ho Feb 02 '23 at 11:56

2 Answers2

2

Please try this line of code in gradle.

id 'org.jetbrains.kotlin.android' version '1.8.0' apply false

2

I have been facing a similar issue with my flutter project and from my assessment the reason is due to a conflicting Kotlin version.

I was running

kotlin_version = '1.7.10'

And had installed

kotlin_version = '1.8.20'

The solution is I updated my project to the latest installed version and it worked for me.

Danc-0
  • 51
  • 4