Detecting System-initiated Process Death on Android


I’m currently writing about Process Death issues on Android and those are hard to reproduce, so I wanted to add a post in there about Detecting Process Death issues with Appium :slight_smile:

Now, to do so manually, an Android Developer needs to do the following on the command line (with adb):

adb shell am kill <package name>

How can I achieve this with Appium?

I am using org.seleniumhq.selenium:selenium-java:4.20.0 and there’s no killPackage() function on AndroidDriver, so who can I reach from my JVM project the killPackage function of the appium-adb project ?

I saw there’s a driver.execute() function, is that the right way? If so, how? :thinking:
Thank you in advance :pray:

Do this with a system call in whatever language you are using.

ETA: I missed that you are using Java:

1 Like

Haven’t thought of doing simply that, worked out well, thank you!

If you use UIA2 driver then try appium-uiautomator2-driver/ at master · appium/appium-uiautomator2-driver · GitHub

1 Like

Thank you! It worked :slight_smile:

Here’s the article I wrote about it → Detecting Process Death issues with Appium | Alexander Gherschon