Description
After upgrading to Espresso 3.5.0-alpha06 any view assertion (onView(...).check(matches(...))) crashes on API 30 & below.
The same tests work with Espresso 3.4.0 & 3.5.0-alpha05, so it seems to be a regression.
Steps to Reproduce
- Create new project, with a basic Espresso test
- Upgrade Espresso to 3.5.0-alpha06
- Run test on device or emulator with API 21-30
Expected Results
Test should pass
Actual Results
Test fails with
java.lang.IncompatibleClassChangeError: Class 'org.hamcrest.StringDescription' does not implement interface 'java.lang.Iterable' in call to 'java.util.Iterator java.lang.Iterable.iterator()' (declaration of 'org.hamcrest.BaseDescription' appears in /data/app/~~0euuGogwUQ-CS9qM-ORXEg==/gmk57.testespresso.test-kBqLXiNXd4caXIOy6UsVNA==/base.apk)
at org.hamcrest.BaseDescription.appendValueList(BaseDescription.java:76)
at androidx.test.espresso.matcher.BoundedDiagnosingMatcher.describeTo(BoundedDiagnosingMatcher.java:4)
at org.hamcrest.BaseDescription.appendDescriptionOf(BaseDescription.java:24)
at org.hamcrest.StringDescription.toString(StringDescription.java:28)
at org.hamcrest.BaseMatcher.toString(BaseMatcher.java:28)
at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2978)
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2855)
at java.util.Formatter.format(Formatter.java:2524)
at java.util.Formatter.format(Formatter.java:2459)
at java.lang.String.format(String.java:2911)
at androidx.test.espresso.ViewInteraction$2.call(ViewInteraction.java:12)
at androidx.test.espresso.ViewInteraction$2.call(ViewInteraction.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
On API 21-25 the error is phrased differently:
java.lang.IncompatibleClassChangeError: The method 'java.lang.Class java.lang.Object.getClass()' was expected to be of type interface but instead was found to be of type virtual (declaration of 'androidx.test.platform.tracing.Tracing' appears in /data/app/gmk57.testespresso.test-1/base.apk)
AndroidX Test and Android OS Versions
Android API 21-30 (not reproducible on 31, not tested on 32)
androidx.test.ext:junit:1.1.3
androidx.test.espresso:espresso-core:3.5.0-alpha06
Android Studio Bumblebee | 2021.1.1 Patch 3
Link to a public git repo demonstrating the problem:
Should be easily reproduced from scratch, but here it is
Description
After upgrading to Espresso 3.5.0-alpha06 any view assertion (
onView(...).check(matches(...))) crashes on API 30 & below.The same tests work with Espresso 3.4.0 & 3.5.0-alpha05, so it seems to be a regression.
Steps to Reproduce
Expected Results
Test should pass
Actual Results
Test fails with
On API 21-25 the error is phrased differently:
AndroidX Test and Android OS Versions
Android API 21-30 (not reproducible on 31, not tested on 32)
androidx.test.ext:junit:1.1.3
androidx.test.espresso:espresso-core:3.5.0-alpha06
Android Studio Bumblebee | 2021.1.1 Patch 3
Link to a public git repo demonstrating the problem:
Should be easily reproduced from scratch, but here it is