question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not launch intent Intent Espresso again

See original GitHub issue

I am testing with the Espresso framework but keep getting the following error:

`java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=aurora.aero.inflightmanager.dds/aurora.aero.inflightmanager.home.HomeActivity } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1501794260595 and now the last time the queue went idle was: 1501794260664. If these numbers are the same your activity might be hogging the event queue. at android.support.test.runner.MonitoringInstrumentation.startActivitySync(MonitoringInstrumentation.java:360) at android.support.test.rule.ActivityTestRule.launchActivity(ActivityTestRule.java:219) at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:268) 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 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 android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59) at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1873)

Tests ran to completion. `

My build.gradle is as follows:

` androidTestCompile(‘com.android.support.test.espresso:espresso-core:2.2.2’, { exclude group: ‘com.android.support’, module: ‘support-annotations’ exclude group: ‘com.android.support’, module: ‘appcompat’ exclude group: ‘com.android.support’, module: ‘support-v4’ exclude group: ‘recyclerview-v7’ exclude group: ‘com.google.guava:guava:19.0’

})`

I have looked at both #56 and #15 and I have excluded every dependency in my production APK from my test APK. I’m still getting the same error. The strange thing is that sometimes it randomly works and the test will pass, but for the most part I get the same error, any ideas?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:17
  • Comments:12

github_iconTop GitHub Comments

6reactions
dkdkdinesh000commented, Aug 5, 2020

any solutions?

Please try with ActivityScenarioRule instead of ActivityTestRule like below

@Rule 
public ActivityScenarioRule<LoginActivity> mActivityRule = new ActivityScenarioRule<>(LoginActivity.class);
4reactions
DongDian455commented, Nov 24, 2021

Turn on background popup permissions. It’s work for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not launch intent Intent { act=android.intent.action.MAIN ...
I experienced this error while running Espresso tests on 6.0 devices but not on 5.1.1 or 7.0 devices. I ...
Read more >
Google Espresso java.lang.RuntimeException: Could not ...
I experienced this error while running Espresso tests on 6.0 devices but not on 5.1.1 or 7.0 devices. I tracked the cause down...
Read more >
Espresso driver fails to start activity (android compose app)
I'm using Appium server v2.0(2.0.0-beta.27), espresso driver (espresso@2.2.0) and ... RuntimeException: Could not launch intent Intent ...
Read more >
Using Espresso to Test and Stub Android Intents - Medium
To accomplish this, we will create an application with an Intent to interact with ... we will need to open the MainActivity.java again....
Read more >
Android/Gradle espresso test not starting activity - iTecNote
I'm having difficulty convincing the new Android build system to run tests. When running the test it gives the Unable to resolve activity...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found