Issue
In short, I'm trying to match view with ID like R.id.signCheckbox
using Espresso. When I try to match that view I will get NoMatchingView exception when it's clear that view is present.
After some debugging, I've found out that inside my test class when I eval R.id.signCheckbox
I'll get ID: -1000984
. Inside cause
of the NoMatchingViewException
you can actually read whole view hierarchy in some format. There I've found that checkbox has different ID 2131362821
. I've read the project R.java
and it's also assigning 2131362821
to R.id.signCheckbox
.
So when I match withId(2131362821)
it's actually working. Why it's not working with R.id.signCheckbox
and where that -1000984
id comes from?
Solution
It looks like the good old Invalidate/Restart/Clean/Rebuild fixed the problem.
The IDs are still negative (like -1000984) not matching the R.java IDs, but Espresso will successfully match the views.
Answered By - JoKr
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.