Gradle duplicate dependencies error even after excluding library - android

I am doing some work on the ProofMode android app and after adding Kotlin to the project, I have been running into duplicate dependencies error, specifically org.slf4j lib as seen below.
Execution failed for task ':app:checkArtworkReleaseDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class org.slf4j.ILoggerFactory found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.IMarkerFactory found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.Logger found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.LoggerFactory found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.MDC found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.MDC$1 found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.MDC$MDCCloseable found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.Marker found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.MarkerFactory found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.event.EventConstants found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.event.EventRecodingLogger found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.event.Level found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.event.LoggingEvent found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.event.SubstituteLoggingEvent found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.BasicMDCAdapter found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.BasicMDCAdapter$1 found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.BasicMarker found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.BasicMarkerFactory found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.FormattingTuple found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.MarkerIgnoringBase found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.MessageFormatter found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.NOPLogger found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.NOPLoggerFactory found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.NOPMDCAdapter found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.NamedLoggerBase found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.SubstituteLogger found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.SubstituteLoggerFactory found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.Util found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.Util$1 found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.helpers.Util$ClassContextSecurityManager found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.spi.LocationAwareLogger found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.spi.LoggerFactoryBinder found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.spi.MDCAdapter found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Duplicate class org.slf4j.spi.MarkerFactoryBinder found in modules jetified-java-opentimestamps-1.17 (com.eternitywall:java-opentimestamps:1.17) and jetified-slf4j-api-1.7.36 (org.slf4j:slf4j-api:1.7.36)
Go to the documentation to learn how to Fix dependency resolution errors.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
I have researched the issue and even adding transitive = true in the opentimestamps block does not fix the issue. The issue does not make sense because, in the project, the opentimestamps library excludes the org.slf4j module as seen below;
implementation('com.eternitywall:java-opentimestamps:1.17') {
transitive = true
exclude group: 'org.bitcoinj'
exclude group: 'com.google.protobuf'
exclude group: 'org.slf4j'
exclude group: 'net.jcip'
exclude group: 'commons-cli'
exclude group: 'org.json'
}
Is there a way for me to exclude the duplicate dependencies?

Related

Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.0

This is Runtime error which I get everytime I run the code
> 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.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> 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.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations 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.jdk8.JDK8PlatformImplementations$ReflectSdkVersion 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.io.path.DirectoryEntriesReader found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.ExperimentalPathApi found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.FileVisitorBuilder found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.FileVisitorBuilderImpl found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.FileVisitorImpl found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.LinkFollowing found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.PathNode found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.PathRelativizer found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.PathTreeWalk found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.PathTreeWalk$bfsIterator$1 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.PathTreeWalk$dfsIterator$1 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.PathTreeWalkKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.PathWalkOption found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.PathsKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.PathsKt__PathReadWriteKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.io.path.PathsKt__PathUtilsKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.jdk7.AutoCloseableKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20)
> Duplicate class kotlin.jvm.jdk8.JvmRepeatableKt 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.jvm.optionals.OptionalsKt 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.random.jdk8.PlatformThreadLocalRandom 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.streams.jdk8.StreamsKt 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.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$1 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.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$2 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.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$3 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.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$4 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.text.jdk8.RegexExtensionsJDK8Kt 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.time.jdk8.DurationConversionsJDK8Kt 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)
Go to the documentation to learn how to Fix dependency resolution errors.
This is my module Gradle FIle
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
}
android {
namespace 'com.app.gympack'
compileSdk 33
defaultConfig {
applicationId 'com.app.gympack'
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_ui_version
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
//Compose
implementation platform("androidx.compose:compose-bom:$compose_bom_version")
implementation "androidx.compose.material:material"
implementation "androidx.compose.material:material-icons-extended"
// Navigation
implementation "androidx.navigation:navigation-compose:2.6.0-alpha04"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.0-alpha05"
//Hilt
implementation "com.google.dagger:hilt-android:$hilt_version"
implementation 'androidx.compose.ui:ui-tooling-preview:1.3.3'
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
//Hilt Navigation Compose
implementation "androidx.hilt:hilt-navigation-compose:$hilt_navigation_compose_version"
// Calendar
implementation 'com.github.JoelKanyi:HorizontalCalendarView:1.0.3'
// Firebase
implementation platform('com.google.firebase:firebase-bom:29.0.1')
implementation 'com.google.firebase:firebase-auth-ktx'
implementation 'com.firebaseui:firebase-ui-auth:8.0.0' // To get icon images etc for login buttons
// Gson
implementation 'com.google.code.gson:gson:2.10'
//Accompanist
implementation "com.google.accompanist:accompanist-navigation-animation:$accompanist_version"
debugImplementation 'androidx.compose.ui:ui-tooling:1.3.3'
//Constraint Layout
implementation("androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha06")
}
This is my Project Gradle File
buildscript {
ext {
compose_ui_version = '1.3.1'
compose_bom_version = '2022.12.00'
hilt_version = '2.44.2'
hilt_navigation_compose_version = '1.0.0'
firebase_bom_version = '31.1.1'
accompanist_version = '0.28.0'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.42"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Whenever i build the app in Android Studio, the files will be re-downloaded again. I have even tried to delete cache file.
Any Solution?
I think this is caused by the alpha version of constraintlayout.
//Constraint Layout
implementation("androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha06")
I had the same issue, when I downgraded the constraintlayout-compose version to 1.0.1 everything worked again.

A failure occurred while executing app:checkDebugDuplicateClasses

I have the following configuration:
Android Studio Electric Eel | 2022.1.1
gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
dependencies.gradle:
ext.versions = [
minSdkLib : 23,
compileSdk : 33,
versionCode : 6,
versionName : '1.0.6',
kotlin_version : '1.7.21',
hilt_android : '2.40.1',
hilt_compiler : '2.40.1',
]
build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
apply from: './dependencies.gradle'
repositories {
google()
mavenCentral()
gradlePluginPortal()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.0'
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$versions.hilt_android"
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (app)
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'kotlin-parcelize'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
id 'dagger.hilt.android.plugin'
}
apply from: '../dependencies.gradle'
android {
compileSdkVersion versions.compileSdk
buildToolsVersion "30.0.3"
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
buildFeatures {
dataBinding = true
// for view binding:
viewBinding true
}
defaultConfig {
applicationId "****"
manifestPlaceholders = [hostName: "****"]
minSdkVersion versions.minSdkLib
targetSdkVersion versions.compileSdk
versionCode versions.versionCode
//versionCode buildDateTime
versionName versions.versionName
setProperty("archivesBaseName", "****")
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
"****"
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
implementation 'androidx.annotation:annotation:1.5.0'
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
implementation "androidx.lifecycle:lifecycle-common-java8:2.5.1"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1"
/*work */
implementation 'androidx.work:work-runtime:2.7.1'
implementation 'com.google.android.material:material:1.7.0'
// Added Dependencies
implementation "androidx.recyclerview:recyclerview:1.2.1"
//
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'androidx.activity:activity-ktx:1.6.1'
implementation("io.coil-kt:coil:1.2.0")
/*Marshmallow permission*/
implementation 'com.karumi:dexter:6.2.3'
/*This is a logger with a small, extensible API which provides utility on top of Android's normal Log class.*/
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation "com.squareup.okhttp3:okhttp:4.10.0"
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'
implementation "com.squareup.retrofit2:converter-moshi:2.9.0"
implementation "com.squareup.moshi:moshi-kotlin:1.13.0"
implementation 'com.squareup.moshi:moshi:1.13.0'
kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.13.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
//Dagger Hilt
implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03'
implementation "com.google.dagger:hilt-android:$versions.hilt_android"
implementation 'org.chromium.net:cronet-embedded:76.3809.111'
kapt "com.google.dagger:hilt-android-compiler:$versions.hilt_compiler"
kapt 'androidx.hilt:hilt-compiler:1.0.0'
// Paging
implementation "androidx.paging:paging-runtime-ktx:3.1.1"
/*kotlin coroutines*/
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0"
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.2")
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
/*ssp for text size for all multiple devices*/
implementation 'com.intuit.ssp:ssp-android:1.0.6'
/*sdp for all multiple devices size*/
implementation 'com.intuit.sdp:sdp-android:1.0.6'
/*Image picker and Camera*/
implementation 'com.github.dhaval2404:imagepicker:2.1'
//Biometric
implementation 'androidx.biometric:biometric:1.1.0'
//FCM
implementation platform('com.google.firebase:firebase-bom:31.0.2')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-messaging-ktx'
//Calendar
implementation 'com.applandeo:material-calendar-view:1.8.0-rc01'
//Horizontal Calendar
implementation 'devs.mulham.horizontalcalendar:horizontalcalendar:1.3.4'
//Stripe SDK
implementation 'com.stripe:stripe-android:20.16.1'
//Testing Libs
testImplementation 'junit:junit:4.13.2'
testImplementation "com.google.truth:truth:1.1.3"
androidTestImplementation "com.google.truth:truth:1.1.3"
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.test:core-ktx:1.4.0"
debugImplementation 'androidx.fragment:fragment-testing:1.5.4'
implementation 'de.hdodenhof:circleimageview:3.1.0'
///Zoom image
implementation 'com.jsibbold:zoomage:1.3.1'
///S: glide
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
//Bar
implementation 'com.github.hadiidbouk:ChartProgressBar-Android:2.0.6'
// One Signal
implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]'
// Color picker
implementation 'com.github.yukuku:ambilwarna:2.0.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.1'
implementation group: 'com.squareup.retrofit2', name: 'adapter-rxjava2', version: '2.6.1'
// Toast
implementation 'com.github.ahmmedrejowan.CuteToast:CuteToast:1.2'
}
I have the following errors:
1: Task 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 jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
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)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations$ReflectSdkVersion found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.io.path.DirectoryEntriesReader 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.io.path.ExperimentalPathApi 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.io.path.FileVisitorBuilder 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.io.path.FileVisitorBuilderImpl 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.io.path.FileVisitorImpl 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.io.path.LinkFollowing 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.io.path.PathNode 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.io.path.PathRelativizer 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.io.path.PathTreeWalk 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.io.path.PathTreeWalk$bfsIterator$1 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.io.path.PathTreeWalk$dfsIterator$1 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.io.path.PathTreeWalkKt 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.io.path.PathWalkOption 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.io.path.PathsKt 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.io.path.PathsKt__PathReadWriteKt 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.io.path.PathsKt__PathUtilsKt 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.jdk7.AutoCloseableKt 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.jvm.jdk8.JvmRepeatableKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.jvm.optionals.OptionalsKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.random.jdk8.PlatformThreadLocalRandom found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.streams.jdk8.StreamsKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$1 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$2 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$3 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$4 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.text.jdk8.RegexExtensionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.time.jdk8.DurationConversionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Caused by: java.lang.RuntimeException: 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.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Caused by: java.lang.RuntimeException: 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.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
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)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations$ReflectSdkVersion found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.io.path.DirectoryEntriesReader 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.io.path.ExperimentalPathApi 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.io.path.FileVisitorBuilder 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.io.path.FileVisitorBuilderImpl 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.io.path.FileVisitorImpl 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.io.path.LinkFollowing 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.io.path.PathNode 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.io.path.PathRelativizer 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.io.path.PathTreeWalk 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.io.path.PathTreeWalk$bfsIterator$1 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.io.path.PathTreeWalk$dfsIterator$1 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.io.path.PathTreeWalkKt 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.io.path.PathWalkOption 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.io.path.PathsKt 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.io.path.PathsKt__PathReadWriteKt 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.io.path.PathsKt__PathUtilsKt 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.jdk7.AutoCloseableKt 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.jvm.jdk8.JvmRepeatableKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.jvm.optionals.OptionalsKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.random.jdk8.PlatformThreadLocalRandom found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.streams.jdk8.StreamsKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$1 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$2 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$3 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$4 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.text.jdk8.RegexExtensionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.time.jdk8.DurationConversionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
I don't understand why it tries to get the classes compiled with Kotlin 1.8.0. I don't have anywhere in the project used this version of Kotlin. I tried multiple version of gradle. I updated the Android Studio and some of the libraries.
I am stuck with this problem for 2 days. Please help! I can share more info about the project if needed.
Many thanks!
For me it was strange because I didn't even include these dependencies.
However, excluding kotlin-stdlib-jdk8 worked.
Add the following in build.gradle (:app)
configurations.implementation {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}
modules { module('org.jetbrains.kotlin:kotlin-stdlib-jdk8') { replacedBy 'org.jetbrains.kotlin:kotlin-stdlib', 'kotlin fixes' } module('org.jetbrains.kotlin:kotlin-stdlib-jdk7') { replacedBy 'org.jetbrains.kotlin:kotlin-stdlib', 'kotlin fixes' } }
This one given by #Adam Marr worked only.

> Task :app:checkDebugDuplicateClasses FAILED

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)
Please try this line of code in gradle.
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false

Class duplicates adding Robolectric in Android instrumentation test

I'm testing and Android app using various frameworks like Robolectric and Mockito. I have an app main project and a related "Libraries" project, linked with the first one and shared with other app. I need to test a Service class in my Libraries using instrumentation test and Robolectric (that I used massively in my JVM test also in Libraries). When I add
androidTestImplementation 'org.robolectric:robolectric:4.3'
to my Module:libraries build.gradle the build goes fine, but when I launch my instrumented test i got this error
Duplicate class com.google.protobuf.AbstractMessage found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.AbstractMessage$Builder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.AbstractMessageLite found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.AbstractParser found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.BlockingRpcChannel found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.BlockingService found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.BoundedByteString found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.BoundedByteString$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.BoundedByteString$BoundedByteIterator found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.ByteString found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.ByteString$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.ByteString$ByteIterator found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.ByteString$CodedBuilder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.ByteString$Output found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.CodedInputStream found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.CodedInputStream$RefillCallback found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.CodedInputStream$SkippedDataSink found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.CodedOutputStream found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.CodedOutputStream$ByteBufferOutputStream found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.CodedOutputStream$OutOfSpaceException found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$Builder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRange found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRange$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRange$Builder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRangeOrBuilder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProtoOrBuilder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumDescriptorProto found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumDescriptorProto$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumDescriptorProto$Builder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumDescriptorProtoOrBuilder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumOptions found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumOptions$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumOptions$Builder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumOptionsOrBuilder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumValueDescriptorProto found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumValueDescriptorProto$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
...
Duplicate class org.apache.maven.artifact.installer.ArtifactInstallationException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.installer.ArtifactInstaller found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.installer.DefaultArtifactInstaller found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.ChecksumFailedException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.DefaultWagonManager found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.DefaultWagonManager$1 found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.DefaultWagonManager$2 found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.DefaultWagonProviderMapping found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.WagonComponentConfigurator found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.WagonConfigurationException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.WagonManager found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.WagonProviderMapping found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.metadata.AbstractArtifactMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.metadata.ArtifactMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.metadata.ArtifactMetadataSource found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.metadata.ResolutionGroup found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.ArtifactRepository found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.ArtifactRepositoryFactory found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.ArtifactRepositoryPolicy found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.DefaultArtifactRepository found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.AbstractRepositoryMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.GroupRepositoryMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.Metadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-repository-metadata-2.2.1.jar (org.apache.maven:maven-repository-metadata:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.Plugin found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-repository-metadata-2.2.1.jar (org.apache.maven:maven-repository-metadata:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadataDeploymentException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadataInstallationException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadataReadException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.Snapshot found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-repository-metadata-2.2.1.jar (org.apache.maven:maven-repository-metadata:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.Versioning found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-repository-metadata-2.2.1.jar (org.apache.maven:maven-repository-metadata:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-repository-metadata-2.2.1.jar (org.apache.maven:maven-repository-metadata:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-repository-metadata-2.2.1.jar (org.apache.maven:maven-repository-metadata:2.2.1)
Duplicate class org.apache.maven.artifact.resolver.AbstractArtifactResolutionException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.resolver.ArtifactCollector found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.resolver.ArtifactNotFoundException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Go to the documentation to learn how to Fix dependency resolution errors.
I tried to exclude, for example, the Protobuff using:
androidTestImplementation 'org.robolectric:robolectric:4.3' {
exclude group: 'com.google.protobuf', module: 'protobuf-java'
}
obtain in this case
ERROR: Could not find method org.robolectric:robolectric:4.3() for arguments [build_byuvhyax0s1u9skwzk0q7eedm$_run_closure2$_closure16#4efcea4d] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Open File
These are my dependecies in gradle:
[app]
dependencies {
implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
implementation "com.android.support:preference-v7:$rootProject.supportLibraryVersion"
implementation "com.android.support:support-v4:$rootProject.supportLibraryVersion"
implementation "com.google.code.gson:gson:$rootProject.gsonVersion"
implementation "commons-io:commons-io:$rootProject.commonsioVersion"
// Dependencies for ButterKnife
implementation "com.jakewharton:butterknife:$rootProject.butterknifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterknifeVersion"
// Dependencies for Dagger
implementation "com.google.dagger:dagger:$rootProject.daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.daggerVersion"
// Dependencies for RxBinding
implementation "com.jakewharton.rxbinding2:rxbinding:$rootProject.rxBindingVersion"
// Dependencies for Rxjava2 and RxAndroid
implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxAndroidVersion"
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxJavaVersion"
// Dependencies for Retrofit
implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
implementation "com.squareup.retrofit2:converter-simplexml:$rootProject.retrofitConverterSimplexmlVersion"
implementation "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:$rootProject.retrofitRxjavaAdapterVersion"
implementation "com.squareup.okhttp:okhttp:$rootProject.okhttpVersion"
// Dependencies for Room
implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
// Glide
implementation "com.github.bumptech.glide:glide:$rootProject.glideVersion"
// AndroidX
testImplementation ('androidx.test:rules:1.1.0') {
exclude module:'kxml2'
}
// Dependencies for JUnit
testImplementation "junit:junit:$rootProject.junitVersion"
androidTestImplementation "junit:junit:$rootProject.junitVersion"
// Mockito framework
testImplementation 'org.mockito:mockito-core:2.4.0'
testImplementation "org.robolectric:robolectric:4.3"
// Multidex
implementation "com.android.support:multidex:$rootProject.multidexVersion"
implementation project(path: ':libraries')
}
[libraries]
dependencies {
implementation "com.android.support:support-v4:$rootProject.supportLibraryVersion"
implementation "com.google.code.gson:gson:$rootProject.gsonVersion"
implementation "commons-io:commons-io:$rootProject.commonsioVersion"
// Dependencies for RxBinding
implementation "com.jakewharton.rxbinding2:rxbinding:$rootProject.rxBindingVersion"
// Dependencies for Rxjava2 and RxAndroid
implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxAndroidVersion"
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxJavaVersion"
// Dependencies for Retrofit
implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
implementation "com.squareup.retrofit2:converter-simplexml:$rootProject.retrofitConverterSimplexmlVersion"
implementation "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:$rootProject.retrofitRxjavaAdapterVersion"
implementation "com.squareup.okhttp:okhttp:$rootProject.okhttpVersion"
// Dependencies for Room
// Room (use 1.1.0-alpha1 for latest alpha)
implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
implementation "android.arch.persistence.room:rxjava2:$rootProject.roomVersion"
annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"
implementation "com.android.support:support-annotations:$rootProject.supportLibraryVersion"
//implementation "org.apache.httpcomponents:httpcore:$rootProject.httpcoreVersion"
// Dependencies for JUnit
testImplementation "junit:junit:$rootProject.junitVersion"
androidTestImplementation "junit:junit:$rootProject.junitVersion"
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation ('androidx.test:runner:1.1.0') {
exclude module:'kxml2'
}
testImplementation ('androidx.test:runner:1.1.0') {
exclude module:'kxml2'
}
androidTestImplementation ('androidx.test:rules:1.1.0') {
exclude module:'kxml2'
}
testImplementation ('androidx.test:rules:1.1.0') {
exclude module:'kxml2'
}
// Mockito framework
testImplementation 'org.mockito:mockito-core:2.13.0'
testImplementation "org.robolectric:robolectric:4.3"
androidTestImplementation 'org.robolectric:robolectric:4.3'
// Multidex
implementation "com.android.support:multidex:$rootProject.multidexVersion"
api files('libs/lifesense_ble_v3.3.7.jar')
api files('libs/pulselibrary-release.aar')
api files('libs/CreativeHealth_pc60nw.jar')
}
I don't understand the problem deeply and I didn't find a much about it. How can i solve this conflicts due to run my instrumented test?
Thanks in advance
Your solution to exclude protobuf-java from Robolectric is the right one, but I believe your problem comes from the syntax - you forgot parenthesis.
Try again with the following:
androidTestImplementation ('org.robolectric:robolectric:4.3') {
exclude group: 'com.google.protobuf', module: 'protobuf-java'
}
Also it seems like you use Robolectric on the testImplementation configuration, so you might want to add the following:
testImplementation ('org.robolectric:robolectric:4.3') {
exclude group: 'com.google.protobuf', module: 'protobuf-java'
}

How to prevent the duplicating classes error in Android

I am using Tesseract and Scanbot Android Document Scanner SDK. Both contain the same class for OCR reading. Since I am using Tesseract I no need to go for the Scanbot PII package which is offering PI packages + OCR. But unfortunately, their PI also contains the Tesseract modules. I need to exclude those classes from scanbot and I tried similar question's answers but it doesn't help.
Gradle:
implementation 'com.rmtheis:tess-two:6.0.0'
implementation 'io.scanbot:sdk-package-ui:$scanbotSdkVersion'
implementation ("io.scanbot:sdk-package-1:$scanbotSdkVersion"){
exclude group: "com.googlecode.leptonica.android"
}
It gives the following error:
Duplicate class com.googlecode.leptonica.android.AdaptiveMap found in
modules classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar
(io.scanbot:sdk-core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Binarize found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Box found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Boxa found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Clip found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Constants found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Convert found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Edge found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Enhance found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.GrayQuant found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.JpegIO found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.MorphApp found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Pix found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Pixa found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Pixa$1 found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Pixa$PixIterator found in
modules classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar
(io.scanbot:sdk-core:1.54.0)
Duplicate class com.googlecode.leptonica.android.ReadFile found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Rotate found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Scale found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Scale$1 found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Scale$ScaleType found in
modules classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar
(io.scanbot:sdk-core:1.54.0)
Duplicate class com.googlecode.leptonica.android.Skew found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.leptonica.android.WriteFile found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class com.googlecode.tesseract.android.PageIterator found in
modules classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar
(io.scanbot:sdk-core:1.54.0)
Duplicate class com.googlecode.tesseract.android.ResultIterator found in
modules classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar
(io.scanbot:sdk-core:1.54.0)
Duplicate class com.googlecode.tesseract.android.TessBaseAPI found in modules
classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar (io.scanbot:sdk-
core:1.54.0)
Duplicate class
com.googlecode.tesseract.android.TessBaseAPI$PageIteratorLevel found in
modules classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar
(io.scanbot:sdk-core:1.54.0)
Duplicate class com.googlecode.tesseract.android.TessBaseAPI$PageSegMode
found
in modules classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar
(io.scanbot:sdk-core:1.54.0)
Duplicate class com.googlecode.tesseract.android.TessBaseAPI$ProgressNotifier
found in modules classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar
(io.scanbot:sdk-core:1.54.0)
Duplicate class com.googlecode.tesseract.android.TessBaseAPI$ProgressValues
found in modules classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar
(io.scanbot:sdk-core:1.54.0)
Duplicate class com.googlecode.tesseract.android.TessPdfRenderer found in
modules classes.jar (com.rmtheis:tess-two:6.0.0) and classes.jar
(io.scanbot:sdk-core:1.54.0)

Categories

Resources