Duplicate class (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)

105 Views Asked by At

I'm currently in the process of compiling my project within Android Studio, and I'm consistently encountering the same error. Despite my best efforts, which have involved making numerous adjustments to the version and even incorporating configurations with exclusion specifications in the dependencies, I have not been able to resolve the issue.

Duplicate class org.hamcrest.BaseDescription found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.BaseMatcher found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.CoreMatchers found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.Description found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.Factory found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.Matcher found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.SelfDescribing found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.StringDescription found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.AllOf found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.AnyOf found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.DescribedAs found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.Is found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.IsAnything found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.IsEqual found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.IsInstanceOf found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.IsNot found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.IsNull found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.core.IsSame found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.internal.ArrayIterator found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.internal.SelfDescribingValue found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
Duplicate class org.hamcrest.internal.SelfDescribingValueIterator found in modules hamcrest-core-1.1 (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)

 

Go to the documentation to learn how to Fix dependency resolution errors.
dependencies {
    implementation 'com.google.android.material:material:1.2.1' 
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.core:core-ktx:1.5.0'
    implementation 'androidx.appcompat:appcompat:1.5.0'
    implementation "org.projectlombok:lombok:1.18.30"
    implementation 'com.google.code.gson:gson:2.8.7'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
    implementation 'com.github.bumptech.glide:glide:4.16.0'
    implementation 'com.googlecode.json-simple:json-simple:1.1.1'
    runtimeOnly 'com.google.android.material:material:1.11.0-alpha03'
    testImplementation 'junit:junit:4.10'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
0

There are 0 best solutions below