Espresso tests failed on real device with api 28
Asked Answered
T

1

4

I downloaded test samples form https://github.com/android/testing-samples And BasicSample doesn't work on the real device with Android 9 works on Android 10. I have an exception. What is wrong? The activity doesn't even launch on the device.

java.lang.AssertionError: Activity never becomes requested state "[CREATED, DESTROYED, RESUMED, STARTED]" (last lifecycle transition = "PRE_ON_CREATE")
at androidx.test.core.app.ActivityScenario.waitForActivityToBecomeAnyOf(ActivityScenario.java:338)
at androidx.test.core.app.ActivityScenario.launchInternal(ActivityScenario.java:272)
at androidx.test.core.app.ActivityScenario.launch(ActivityScenario.java:195)
at androidx.test.ext.junit.rules.ActivityScenarioRule.lambda$new$0$ActivityScenarioRule(ActivityScenarioRule.java:70)
at androidx.test.ext.junit.rules.ActivityScenarioRule$$Lambda$0.get(Unknown Source:2)
at androidx.test.ext.junit.rules.ActivityScenarioRule.before(ActivityScenarioRule.java:103)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at androidx.test.ext.junit.runners.AndroidJUnit4.run(AndroidJUnit4.java:154)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
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:56)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2154)
Triny answered 3/8, 2020 at 13:17 Comment(2)
Looks like you provided the wrong link.Triny
Sorry this is the correct one #53598821Burks
A
3

This is a problem of permissions. Just allow autostart and pop-up window for this app on your android phone settings.

https://github.com/android/android-test/issues/857#issuecomment-965859405

Apocope answered 11/11, 2021 at 0:25 Comment(3)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Helaine
In order to be immediately helpful to readers (and avoid link-rot), we prefer answers that provide at least a summary of the solution directly, with links used to offer additional information. Please edit your answer.Amoreta
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From ReviewSusurrant

© 2022 - 2024 — McMap. All rights reserved.