I’m currently taking a Udemy class to learn Android development with Kotlin. At the end of the last two exercises I’m running into the following compile issues:
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 androidx.databinding.BaseObservable found in modules databinding-runtime-8.2.1-runtime (androidx.databinding:databinding-runtime:8.2.1) and library-3.2.0-alpha11-runtime (androidx.databinding:library:3.2.0-alpha11)
Duplicate class androidx.databinding.BaseObservableField found in modules databinding-runtime-8.2.1-runtime (androidx.databinding:databinding-runtime:8.2.1) and library-3.2.0-alpha11-runtime (androidx.databinding:library:3.2.0-alpha11)
Duplicate class androidx.databinding.BaseObservableField$DependencyCallback found in modules databinding-runtime-8.2.1-runtime (androidx.databinding:databinding-runtime:8.2.1) and library-3.2.0-alpha11-runtime (androidx.databinding:library:3.2.0-alpha11)
Duplicate class androidx.databinding.Bindable found in modules baseLibrary-3.2.0-alpha11 (androidx.databinding:baseLibrary:3.2.0-alpha11) and databinding-common-8.2.1 (androidx.databinding:databinding-common:8.2.1)
…
…
…
And it goes on forever…
The instructor in the class had a similar issue but updated the build.gradle.kts for the following:
Update to the following….
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
From ....
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
They said it was from the use of the plugin: id(“kotlin-kapt”)
Can someone help me out? There is a sea of information on this but I was hoping someone might have some insight.