'Don't start Android UI test from Android Studio on real device
- UI Tests on Emulator - ok
 - Debug on real device - ok
 - UI Tests on real device - don't start with error:
 
java.lang.AssertionError: Activity never becomes requested state "[STARTED, CREATED, RESUMED, DESTROYED]" (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) .....
@LargeTest @RunWith(AndroidJUnit4ClassRunner::class) .....
ActivityScenario.launch(SplashActivity::class.java)
Solution 1:[1]
Allow the "display pop-up windows while running in the background permission" or something similar to that. It worked for me on a Redmi Note 8 device
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | Michael Omaka | 
