title: Android Espresso does not work properly
body: <p>I am digging for more than one week for an android tests with espresso.
  I can not make Idle resourses work properly in my project (integrate into project).
  Here is what I added to build.gradle : </p>
  
  <pre><code>dependencies {
      // Testing-only dependencies
      androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
      androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
  }
  
  testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  </code></pre>
  
  <p>What is in test class:</p>
  
  <pre><code>    SetUp:
  countingResource = new CountingIdlingResource("HelloWorldServerCalls");
  Espresso.registerIdlingResources(countingResource);    
  </code></pre>
  
  <p>In Test method:</p>
  
  <pre><code>Espresso.onView(ViewMatchers.withId(R.id.btnLogIn)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()));
          Log.d(TAG, "We are in WalkthroughActivity, user is not logged in");
  
  //press button  - walk to next activity
  Espresso.onView(ViewMatchers.withId(R.id.btnLogIn)).perform(ViewActions.click());
  
  //register MyUserHelperV2 - this is Server decorator
   final LoginActivity act = (LoginActivity) getCurrentActivity();
          LoginActivity.Server aHelper = act.getUserHelper();
          MyUserHelperV2 helper = new MyUserHelperV2(aHelper, countingResource);
          act.setUserHelper(helper);
  
      //set password and email
    Espresso.onView(ViewMatchers.withId(R.id.email)).perform(ViewActions.typeText("test@mail.ru"));
      Espresso.onView(ViewMatchers.withId(R.id.password)).perform(ViewActions.typeText("password111"));
           //Check if button R.id.btnLogInApp exists: 
  Espresso.onView(ViewMatchers.withId(R.id.btnLogInApp)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()));
  
  Espresso.closeSoftKeyboard();
      Espresso.onView(ViewMatchers.withId(R.id.btnLogInApp)).perform(ViewActions.click());
      //in last line we have PerformException - can not find R.id.btnLogInApp, 
  </code></pre>
  
  <p>But for sure this button exist - I can emulate not-idle(sync) call and all is working OK.
  I am thinking I can make a mistake in settings - on android 5 all works, on other androids &lt;5 - does not.</p>
  
  <p>I have dug through a lot of samples, and for sure implemented Idle res perfectly. But I am too bad with gradle system.
  Please help, I am desperate with espresso and gradle, I can attach more spec code if needed.</p>