title: espresso onView inconsistent performance
body: <p>I am using Junit4 and Espresso for my tests. I am facing a weird issue with espresso tests - when I call onView sometimes everything is executed like it is supposed to, but sometimes my test freezes and after 60 seconds I get something like this "android.support.test.espresso.AppNotIdleException: Looped for 63 iterations over 60 SECONDS. The following Idle Conditions failed ASYNC_TASKS_HAVE_IDLED"
  For example :</p>
  
  <pre><code>    onView(withId(R.id.zone_button_continue)).perform(click());
      onView(withId(R.id.loginButton)).check(matches(isDisplayed()));
      onView(withId(R.id.number)).check(matches(isDisplayed()));
      onView(withId(R.id.password)).check(matches(isDisplayed()));
      onView(withId(R.id.number)).perform(typeText(phoneNumber));
      onView(withId(R.id.password)).perform(typeText(password));
      onView(withId(R.id.loginButton)).perform(click());
  </code></pre>
  
  <p>everything gets executed correctly, except the last line - for some reason it can't find that loginButton, but it is there 100% percent. I can do</p>
  
  <pre><code>activity.runOnUiThread(new Runnable() {
          @Override
          public void run() {
              activity.findViewById(R.id.loginButton).performClick();
               }
      });
  </code></pre>
  
  <p>and that works. I have similar problems throughout most of my activities -  sometimes onView is working sometimes not. </p>
  
  <p>What could cause such an inconsistency? I have been fighting with this issue for a while, and it makes my testing very frustrating and difficult. My conclusions this far is that something is wrong with my gradle dependencies or there is some kind of bug in my application that prevents espresso to work properly. But it is strange that in the example above everything with onView is working except last line and everything is happening in one activity and that makes me doubt that the bug is within my application.
  Here are my gradle dependencies: </p>
  
  <pre><code>compile files('src/main/libs/guice-3.0-no_aop.jar')
  compile files('src/main/libs/javax.inject-1.jar')
  compile files('src/main/libs/roboguice-2.0.jar')
  compile files('src/main/libs/junit-4.11.jar')
  compile files('src/main/libs/hamcrest-core-1.3.jar')
  compile files('src/main/libs/GeoLib.jar')
  compile files('src/main/libs/GeoPolygons.jar')
  compile files('src/main/libs/universal-image-loader-1.9.4.jar')
  compile files('src/main/libs/javax.annotation-3.2-b06-sources.jar')
  compile ('uk.co.chrisjenx:calligraphy:2.1.0'){
      exclude group:'com.android.support'
  }
  compile 'com.squareup:otto:1.3.5'
  compile ('com.google.android.gms:play-services:6.5.87'){
      exclude group:'com.android.support'
  }
  compile 'com.android.support:support-annotations:22.2.1'
  compile ('com.android.support:appcompat-v7:22.2.0'){
      exclude group:'com.android.support'
  }
  compile ('com.android.support:support-v4:22.2.0'){
      exclude group:'com.android.support', module:'support-annotations'
  }
  compile ('com.android.support:palette-v7:22.2.0'){
      exclude group:'com.android.support'
  }
  compile 'com.google.code.findbugs:jsr305:2.0.1'
  
  compile 'com.nineoldandroids:library:2.4.0'
  compile 'pl.charmas.android:android-reactive-location:0.4@aar'
  compile 'io.reactivex:rxjava:1.0.3'
  compile files('src/main/libs/FlurryAnalytics-6.1.0.jar')
  compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
  //    androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
  androidTestCompile('com.android.support.test:runner:0.4.1') {
      exclude group: 'com.android.support', module: 'support-annotations'
  }
  // Set this dependency to use JUnit 4 rules
  androidTestCompile('com.android.support.test:rules:0.4.1') {
      exclude group: 'com.android.support', module: 'support-annotations'
  }
  // Set this dependency to build and run Espresso tests
  androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.1') {
      exclude group: 'com.android.support', module: 'support-annotations'
  }
  
  androidTestCompile('com.android.support.test.espresso:espresso-intents:2.2.1') {
      exclude group: 'com.android.support', module: 'support-annotations'
  }
  androidTestCompile('com.android.support.test.espresso:espresso-web:2.2.1') {
      // PackagingOptions modified to make this work
      exclude group: 'com.android.support', module: 'support-annotations'
  }
  testCompile 'junit:junit:4.11'
  testCompile ('org.mockito:mockito-core:1.9.5'){
      exclude group: 'org.hamcrest'
  }
  compile 'org.mod4j.org.apache.commons:lang:2.1.0'
  </code></pre>
  
  <p>Please help me with this problem, I am completely out of ideas and stuck with it.</p>