Espresso AmbiguousViewMatcherException when trying to click a navigation button

https://stackoverflow.com/a/29663042/7828429 Just check For View isDisplayed() all things will be work fine

   onView(allOf(withId(..),isDisplayed())).perform(click());

This is not a bug in Espresso. The view hierarchy clearly shows two views having the same ID. This is likely due to the view being inside a ViewPager, which is an AdapterView. So multiple instances are to be expected.

To solve this, be more specific when matching the view. Going just by ID doesn't help. Since the other ImageView for the home button is not visible, because it's parent is GONE, you can simply match for that:

onView(allOf(withId(..), withEffectiveVisibility(VISIBLE))).perform(click());