This is only on Android devices with api level 28. trying to match a text after clicking the spinner fails.
Two approaches, one looking for a window that is not the activity, the second is looking for popup menu:
...
// Look for text "Green" in the menu
onView(withId(getFieldId(COLOR_ID))).perform(click());
onView(withText("Green"))
.inRoot(withDecorView(not(is(rule.getActivity().getWindow().getDecorView())))) // Look for popup menu
.perform(click());
// Second spinner, Look for the text "Medium"
onView(withId(getFieldId(SIZE_ID))).perform(click());
onView(withText("Medium")).inRoot(RootMatchers.isPlatformPopup()).perform(click());
...
Both are working fine with devices API <=27
Any idea why this is not working on 28? Thank you.
Problem solved by updating build tools version to 28.0.2 (was 28.0.1) and replaced all android support libraries to use androidx