Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Version used:
What steps will reproduce the problem?
1. Call IntentsTestRule.launchActivity, and then finish activity
2. Call IntentsTestRule.launchActivity again in the same test case
3. Crash
How are you running your tests (via Android Studio, Gradle, adb, etc.)?
adb instrument
What is the expected output? What do you see instead?
The below error causes the Activity crash.
java.lang.IllegalStateException: #init was called twice in a row. Make sure to call #release after every #init
at android.support.test.espresso.intent.Checks.checkState(Checks.java:75)
at android.support.test.espresso.intent.Intents.internalInit(Intents.java:252)
at android.support.test.espresso.intent.Intents.init(Intents.java:133)
at android.support.test.espresso.intent.rule.IntentsTestRule.afterActivityLaunched(IntentsTestRule.java:59)
at android.support.test.rule.ActivityTestRule.launchActivity(ActivityTestRule.java:308)
The problem is that afterActivityLaunched is invoked 2 times, but afterActivityFinished is not called when activity finishes but until tearDown.
I think the fix is to call afterActivityFinished when activity finishes.