I have just created a new project in android studio with the bottom navigation views activity. I have tried to build right away without adding anything but i get this error
!Duplicate Class Found
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)
Can anyone help me on how to resolve it
my dependencies are as below
dependencies {
implementation libs.appcompat
implementation libs.material
implementation libs.constraintlayout
implementation libs.lifecycle.livedata.ktx
implementation libs.lifecycle.viewmodel.ktx
implementation libs.navigation.fragment
implementation libs.navigation.ui
testImplementation libs.junit
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.espresso.core
}
i really cant see where the problem is coming from because all of the files where auto-generated its a new project.
I got the solution that works, the solution was add a contraints block to dependecies in build.gradle as shown below
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")
}
}
implementation libs.appcompat
implementation libs.material
implementation libs.constraintlayout
implementation libs.lifecycle.livedata.ktx
implementation libs.lifecycle.viewmodel.ktx
implementation libs.navigation.fragment
implementation libs.navigation.ui
testImplementation libs.junit
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.espresso.core
}
this prevents the Kotlin grdadle plugin from using duplicate classes from the different versions