Hi there I am new to Android Junit testing:
I have written some test code in MainActivityFunctionalTest.java file
MainActivityFunctionalTest.java:
I had exactly the same problem and error message when running espresso tests. One of them was always failing when running whole package, however it always passed when I was running it alone. Interesting thing was that the problem happened because I had added following line to one of my Activities in AndroidManifest.xml:
android:windowSoftInputMode="stateUnchanged|adjustResize"
After removing or changing above line to:
android:windowSoftInputMode="stateHidden"
mentioned test was passing also when running whole package.