Recreation test fails

After following all instructions through to the end of Chapter 6 Testing, the recreation Espresso test fails, although the logs properly show the recreation working in Chapter 5.

Below I have included the Error Log (I only included the lower portion due to the entire log being twice as many characters as allowed here) and a snip of Error explanation that was positioned directly above the log. Any help is appreciated. Thanks!

portion of Error log:

The complete view hierarchy is available in artifact file ‘view-hierarchy-1.txt’.
at androidx.test.espresso.NoMatchingViewException$Builder.build(NoMatchingViewException.java:5)
at androidx.test.espresso.base.DefaultFailureHandler.lambda$getNoMatchingViewExceptionTruncater$0(DefaultFailureHandler.java:5)
at androidx.test.espresso.base.DefaultFailureHandler$$ExternalSyntheticLambda1.truncateExceptionMessage(Unknown Source:2)
at androidx.test.espresso.base.ViewHierarchyExceptionHandler.handleSafely(ViewHierarchyExceptionHandler.java:5)
at androidx.test.espresso.base.ViewHierarchyExceptionHandler.handleSafely(ViewHierarchyExceptionHandler.java:1)
at androidx.test.espresso.base.DefaultFailureHandler$TypedFailureHandler.handle(DefaultFailureHandler.java:4)
at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:5)
at androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:8)
at androidx.test.espresso.ViewInteraction.check(ViewInteraction.java:12)
at com.bignerdranch.android.geoquiz.MainActivityTest.handlesActivityRecreation(MainActivityTest.kt:47)

Error explanation:

Hey, I see the same issue that you are. Thankfully, by updating the androidx.test.espresso:espresso-core library to 3.5.1, your issue is resolved. I’m gonna dig into what’s changed in that library to see what was fixed.

Try updating the library and see if that fixes the problem for you.

hmm. I am using 3.5.1, but still have the problem. I do appreciate the response, let me know if you have any other thoughts.

Strange. Some of the tools that you learned about in the previous chapter (Debugging) could probably help you out here. Try putting a breakpoint on the last expression (the onView(...) line) and see what happens. Espresso runs the tests on the device, so you should be able to see what Espresso sees at that moment. That might point you in the right direction.