awaitility icon indicating copy to clipboard operation
awaitility copied to clipboard

Dependency problem

Open hannesa2 opened this issue 4 years ago • 3 comments

When I use

    androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
    androidTestImplementation 'androidx.test:rules:1.4.0'
    androidTestImplementation "androidx.test:runner:1.4.0"

    androidTestImplementation "androidx.test.ext:junit:1.1.3"
    androidTestImplementation "androidx.test.ext:truth:1.4.0"
    androidTestImplementation 'org.awaitility:awaitility:4.1.0'

I run into

     Duplicate class org.hamcrest.CustomTypeSafeMatcher found in modules jetified-hamcrest-2.1 (org.hamcrest:hamcrest:2.1) and jetified-hamcrest-core-1.3 (org.hamcrest:hamcrest-core:1.3)
     Duplicate class org.hamcrest.Description found in modules jetified-hamcrest-2.1 (org.hamcrest:hamcrest:2.1) and jetified-hamcrest-core-1.3 (org.hamcrest:hamcrest-core:1.3)
     Duplicate class org.hamcrest.Description$NullDescription found in modules jetified-hamcrest-2.1 (org.hamcrest:hamcrest:2.1) and jetified-hamcrest-core-1.3 (org.hamcrest:hamcrest-core:1.3)
     Duplicate class org.hamcrest.DiagnosingMatcher found in modules jetified-hamcrest-2.1 (org.hamcrest:hamcrest:2.1) and jetified-hamcrest-core-1.3 (org.hamcrest:hamcrest-core:1.3)
     Duplicate class org.hamcrest.FeatureMatcher found in modules jetified-hamcrest-2.1 (org.hamcrest:hamcrest:2.1) and jetified-hamcrest-core-1.3 (org.hamcrest:hamcrest-core:1.3)
     Duplicate class org.hamcrest.Matcher found in modules jetified-hamcrest-2.1 (org.hamcrest:hamcrest:2.1) and jetified-hamcrest-core-1.3 (org.hamcrest:hamcrest-core:1.3)
     Duplicate class org.hamcrest.MatcherAssert found in modules jetified-hamcrest-2.1 (org.hamcrest:hamcrest:2.1) and jetified-hamcrest-core-1.3 (org.hamcrest:hamcrest-core:1.3)
     Duplicate class org.hamcrest.Matchers found in modules jetified-hamcrest-2.1 (org.hamcrest:hamcrest:2.1) and jetified-hamcrest-library-1.3 (org.hamcrest:hamcrest-library:1.3)
     Duplicate class org.hamcrest.SelfDescribing found in modules jetified-hamcrest-2.1 (org.hamcrest:hamcrest:2.1) and jetified-hamcrest-core-1.3 (org.hamcrest:hamcrest-core:1.3)

     and much more ...

It's because you use org.hamcrest:hamcrest:2.1 image

and recent Android libs comes with org.hamcrest:hamcrest-core:1.3 image

any Ideas ?

hannesa2 avatar Oct 04 '21 05:10 hannesa2

Ok, I solved it with

    androidTestImplementation('org.awaitility:awaitility:4.1.0') {
        transitive = false
    }

But I'm confused about this different versions. Is there any chance to change this ins your library ?

hannesa2 avatar Oct 04 '21 05:10 hannesa2

@hannesa2 Don't know much about espresso-core, but what I do know is that hamcrest 1.x is really old. I would say that they should probably upgrade :)

johanhaleby avatar Oct 19 '21 14:10 johanhaleby

The same problem is also reported here: https://github.com/awaitility/awaitility/issues/194

Thank you for your solution.

ozmium avatar Oct 13 '23 16:10 ozmium