android / android/android-test

Unresolved hamcrest Matchers when updating espresso to v3.4.0

Open
#1,352 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
11h 29m
Merged PRs (30d)
2

Description

### Description
After updating my espresso dependency from v3.3.0 to v3.4.0 my project complains that it can't find `hamcrest Matchers`.
I'm using the following espresso dependencies:
```
private const val version = "3.4.0"
const val core = "androidx.test.espresso:espresso-core:$version"
const val contrib = "androidx.test.espresso:espresso-contrib:$version"
const val intents = "androidx.test.espresso:espresso-intents:$version"
const val accessibility = "androidx.test.espresso:espresso-accessibility:$version"
const val web = "androidx.test.espresso:espresso-web:$version"
```

And I'm adding these in my project using `androidTestImplementation`

### Expected Results
The test compiles and I can run instrumentation tests

### Actual Results
I get a bunch of Unresolved reference errors
```
Unresolved reference: equalTo
Unresolved reference: Matchers
Unresolved reference: allOf
Unresolved reference: is
.
.
.
```

The same configuration works fine if I use `v3.3.0`

It also works if I explicitly add `org.hamcrest:hamcrest:2.2` dependency

Contributor guide

Open the contributing guide

Research direction

Start by comparing the Espresso 3.3.0 and 3.4.0 dependency behavior for the listed espresso artifacts, which are added with androidTestImplementation. Check whether Hamcrest is available transitively in 3.4.0; the report says adding org.hamcrest:hamcrest:2.2 makes the tests compile. Done means the test can resolve the reported Hamcrest references without that manual dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.