Barista test crashing after clickBack

I’m using Barista to test my Android app. I have two activities, Main and Download. In the main activity, I have a button that starts the download activity:

findViewById(R.id.download_button).setOnClickListener(
    v -> startActivity(new Intent(this, DownloadActivity.class))
):

When I run my app in the emulator, this works just fine. I can navigate to the download activity and click back to go back to the main activity. However, when I try to test this via Barista

BaristaClickInteractions.clickOn(R.id.download_button);
BaristaVisibilityAssertions.assertDisplayed(R.id.download_activity);
BaristaClickInteractions.clickBack();
BaristaVisibilityAssertions.assertDisplayed(R.id.main_activity);

the test fails. That is, it successfully transitions to the download activity but then just sits there.

Looking at logcat, I see

LifecycleMonitor        com.example.myapp              D  Lifecycle status change: com.example.myapp.activities.DownloadActivity@f0cd78d in: CREATED
LifecycleMonitor        com.example.myapp              D  Lifecycle status change: com.example.myapp.activities.DownloadActivity@f0cd78d in: STARTED
LifecycleMonitor        com.example.myapp              D  Lifecycle status change: com.example.myapp.activities.DownloadActivity@f0cd78d in: RESUMED
EGL_emulation           com.example.myapp              D  eglMakeCurrent: 0x6fb0c4fe00: ver 3 0 (tinfo 0x6fb0c0d9a0)
EGL_emulation           com.example.myapp              D  eglMakeCurrent: 0x6fb0c4fe00: ver 3 0 (tinfo 0x6fb0c0d9a0)
EGL_emulation           com.example.myapp              D  eglMakeCurrent: 0x6fb0c4fe00: ver 3 0 (tinfo 0x6fb0c0d9a0)
EGL_emulation           com.example.myapp              D  eglMakeCurrent: 0x6fb0c4fe00: ver 3 0 (tinfo 0x6fb0c0d9a0)
View                    com.example.myapp              W  dispatchProvideAutofillStructure(): not laid out, ignoring
chatty                  com.example.myapp              I  uid=10127(u0_a127) com.example.myapp identical 7 lines
View                    com.example.myapp              W  dispatchProvideAutofillStructure(): not laid out, ignoring
AssistStructure         com.example.myapp              I  Flattened final assist data: 5680 bytes, containing 1 windows, 26 views
EGL_emulation           com.example.myapp              D  eglMakeCurrent: 0x6fb0c4fe00: ver 3 0 (tinfo 0x6fb0c0d9a0)
OpenGLRenderer          com.example.myapp              D  endAllActiveAnimators on 0x6fac5f7c00 (RippleDrawable) with handle 0x6fb0cfea00
EGL_emulation           com.example.myapp              D  eglMakeCurrent: 0x6fb0c4fe00: ver 3 0 (tinfo 0x6fb0c0d9a0)
ViewInteraction         com.example.myapp              I  Checking 'MatchesViewAssertion{viewMatcher=(view has effective visibility <VISIBLE> and view.getGlobalVisibleRect() to return non-empty rectangle)}' assertion on view view.getId() is <2131230877/com.example.myapp:id/download_activity>
ViewInteraction         com.example.myapp              I  Performing 'send keyCode: 4, metaState: 0 key event' action on view view.getRootView() to equal view
LifecycleMonitor        com.example.myapp              D  Lifecycle status change: com.example.myapp.activities.MainActivity@cf78e44 in: STOPPED
KeyEventActionBase      com.example.myapp              I  Back was pressed but there was no Activity stage transition in 150ms. Pressing back may trigger an activity stage transition if the activity is finished as a result. However, the activity may handle the back behavior in any number of other ways internally as well, such as popping the fragment back stack, dismissing a dialog, otherwise manually transacting fragments, etc.
ViewInteraction         com.example.myapp              I  Checking 'MatchesViewAssertion{viewMatcher=(view has effective visibility <VISIBLE> and view.getGlobalVisibleRect() to return non-empty rectangle)}' assertion on view view.getId() is <2131230979/com.example.myapp:id/main_activity>
takeScreenshot          com.example.myapp              D  Found 2 global views to redraw
ProfileInstaller        com.example.myapp              D  Installing profile for com.example.myapp
takeScreenshot          com.example.myapp              W  force redraw failed. Proceeding with screenshot
                                        java.util.concurrent.TimeoutException: Waited 5 seconds (plus 903044 nanoseconds delay) for androidx.concurrent.futures.ResolvableFuture@483c846[status=PENDING, info=[setFuture=[androidx.test.core.app.ListFuture@f45ca07]]]
                                            at androidx.concurrent.futures.AbstractResolvableFuture.get(AbstractResolvableFuture.java:456)
                                            at androidx.test.core.app.DeviceCapture.takeScreenshotNoSync(DeviceCapture.kt:120)
                                            at androidx.test.espresso.base.DefaultFailureHandler.takeScreenshot(DefaultFailureHandler.java:2)
                                            at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:3)
                                            at com.adevinta.android.barista.internal.failurehandler.SpyFailureHandler.resendFirstError(SpyFailureHandler.kt:26)
                                            at com.adevinta.android.barista.internal.AssertAnyKt.assertAnyView(AssertAny.kt:40)
                                            at com.adevinta.android.barista.internal.AssertAnyKt.assertAny(AssertAny.kt:18)
                                            at com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed(BaristaVisibilityAssertions.kt:33)
                                            at com.example.myapp.tests.MainActivityTest.toDownloadActivityAndBack(MainActivityTest.java:79)
                                            at java.lang.reflect.Method.invoke(Native Method)
                                            at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
                                            at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
                                            at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
                                            at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
                                            at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)
                                            at androidx.test.internal.runner.junit4.statement.RunAfters.evaluate(RunAfters.java:61)
                                            at com.adevinta.android.barista.rule.cleardata.ClearFilesRule$apply$1.evaluate(ClearFilesRule.kt:25)
                                            at com.adevinta.android.barista.rule.cleardata.ClearDatabaseRule$apply$1.evaluate(ClearDatabaseRule.kt:31)
                                            at com.adevinta.android.barista.rule.cleardata.ClearPreferencesRule$1.evaluate(ClearPreferencesRule.java:26)
                                            at androidx.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:543)
                                            at com.adevinta.android.barista.rule.flaky.internal.AllowFlakyStatement.evaluate(AllowFlakyStatement.java:27)
                                            at org.junit.rules.RunRules.evaluate(RunRules.java:20)
                                            at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
                                            at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
                                            at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
                                            at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
                                            at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
                                            at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
                                            at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
                                            at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
                                            at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
                                            at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
                                            at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
                                            at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
                                            at org.junit.runners.Suite.runChild(Suite.java:128)
                                            at org.junit.runners.Suite.runChild(Suite.java:27)
                                            at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
                                            at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
                                            at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
                                            at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
                                            at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
                                            at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
                                            at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
                                            at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
                                            at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
                                            at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:67)
                                            at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:58)
takeScreenshot          com.example.myapp              W    at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:446)
                                            at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2074)

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật