title: Android Espresso - No views in hierarchy found matching
body: <p>I have an android app that I'm trying to do some basic testing on. </p>
  
  <pre><code>public class TimePickerTest {
  
  @Rule
  public ActivityTestRule&lt;MainActivity&gt; mActivityRule = new ActivityTestRule&lt;&gt;(MainActivity.class);
  
  @Test
  public void timePickerReturnsATime() {
  
      onView(withId(R.id.timePickerLayout)).perform(click());
  </code></pre>
  
  <p>When I run this, I get "No views in hierarchy found matching". And it lists up a huge list of the hierarchy. The beginning looks like this:</p>
  
  <pre><code>View Hierarchy:
  +&gt;DecorView{id=-1, visibility=VISIBLE, width=1080, height=1920, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2} |
  +-&gt;LinearLayout{id=-1, visibility=VISIBLE, width=1080, height=1776, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2} |
  +--&gt;ViewStub{id=16909225, res-name=action_mode_bar_stub, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
  </code></pre>
  
  <p>It has tons of views which is hard to identify and the id number doesn't make sense to me. How do I access the views I want? Do I have to start at the home screen and navigate me to the view I want?</p>
  
  <p>The only view I have managed to access yet, is the fragment_container, but I can't figure out where to go from there.</p>