Application Not Closing in Android

Hi Guys

I want to close Application in end of tests

I will Try with CloseApp , Quit , terminateApp , adb shell am force-stop «app_package»
but its still running in background

does not close completely
If I press the home button on the device, the app is still there

Why ? we have more solution ?

Thanks

you can try set fullReset capability to true.
docs: https://appium.io/docs/en/writing-running-appium/other/reset-strategies/

Thanks @ido_oserovitz
but its not option for me :pensive:
i cant remove Application from device
i need just close

Elad

Thanks @mykola-mokhnach
So right now
We don’t have a solution that completely closes the app
Right ?

Elad

The app is closed. If you’d like to ask if there is a solution to remove recent app previews then the answer is “no”.

Thanks @mykola-mokhnach

I found a nice solution that works great :slight_smile:
we can click on recent app , and click on clear all button
with
driver.pressKey(new KeyEvent().withKey(AndroidKey.APP_SWITCH));
and
I used the position of the button
Because it does not recognize the element

TouchAction touchAction = new TouchAction(driver);
touchAction.tap(PointOption.point(x, y)).perform();

@mykola-mokhnach

Elad