xMaster
xMaster

Reputation: 41

How can i solved this error: app:checkDebugDuplicateClasses Failed

My error:

Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and kotlin-stdlib-jdk8-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20)

I was try to fix it by changing in build.gradle (Project)

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

to

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

but I got this error:

'compileDebugJavaWithJavac' task (current target is 1.8) and 'kaptGenerateStubsDebugKotlin' task (current target is 18) jvm target compatibility should be set to the same Java version.

The errors starts showing when i try to setup Dagger-Hilt in my project.

I upload project to github, because I don't know which files I should share: https://github.com/DawidSiudeja/WordlePL

EDIT I add in build.gradle dependencies:

constraints {
        implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") {
            because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib")
        }
        implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") {
            because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
        }
    }

and another errors :/

Upvotes: 0

Views: 413

Answers (1)

The problem is that you use a compose compiler library which is not compatible with your kotlin library in 1.8.0

you can follow the documentation here to solve for future cases: https://developer.android.com/jetpack/androidx/releases/compose-kotlin

enter image description here

Steps to fix: (Acording to kotlin library 1.8.0) You must need to change la compose compiler to 1.4.0 or 1.4.1

open your build.gradle and look for composeOptions then change the current version for the compatible version:

composeOptions {
    kotlinCompilerExtensionVersion '1.4.0'
}

Upvotes: 1

Related Questions