I am able to start native applications using am start -a action -n packagename/activity
. How can I kill/stop a native application from adb shell
?

- 16,981
- 4
- 79
- 106

- 1,421
- 5
- 20
- 36
-
1possible duplicate of [Stopping an Android app from console](http://stackoverflow.com/questions/3117095/stopping-an-android-app-from-console) – janot Oct 21 '14 at 11:46
4 Answers
adb shell am force-stop packagename

- 4,100
- 2
- 22
- 12
-
1@SteveRichey Why would this not work on Unix? I just tried it on Ubuntu 14.04 and it works great. – Chris Foster Jun 16 '14 at 01:18
-
2@ChrisFoster I only meant that, as opposed to the top answer (which doesn't work in Windows), this works for Windows users. – steve richey Jun 17 '14 at 21:35
-
Since killing foreground process requires root access, this might just be the next best option! – Eric Tjitra Jun 18 '20 at 19:42
Chirag deleted it, so here it is again:
adb shell ps | grep com.myapp | awk '{print $2}' | xargs adb shell kill
This is to be run outside of the emulator. It is one long Unix command, not four commands with a visual separation. |
is syntax, interpreted by your (Ubuntu's) shell, which then pipes the output from adb, grep, etc., into the next. Only ps
is executed in the emulator.

- 5,459
- 17
- 29
-
Just the ``adb shell ps | grep $1 | awk '{print $2}'`` portion is great for extracting just the PID of a named app ($1 in this example). – scorpiodawg Jun 19 '12 at 02:11
-
1If you can't kill the service because you need root access, modify the last part to reflect `xargs adb shell 'su -c kill'`. Also, http://stackoverflow.com/a/9418553/198348 is related. – Ehtesh Choudhury Apr 03 '13 at 02:04
-
Another way to kill your app is to send your app to backround (using home button) and call:
adb shell am kill com.your.package
It works not on all of my devices, however, on devices where it works it behaves the same way as if the app was killed in background due to lack of resources and this state is often handy to test different aspects of your process recreation.
For example, if you have Broadcast Receivers registered in Manifest, they will still start without restarting your app manually, comparing to force stop that you can achieve using:
adb shell am force-stop com.your.package

- 6,533
- 2
- 37
- 67
Please try the below command in adb shell.
adb shell kill <PID>

- 56,621
- 29
- 151
- 198
-
1@user774217, That's not to be run in android's shell. See that it begins with `adb shell`? Try it in Ubuntu. – Julian Fondren Feb 16 '12 at 06:53
-
-
This kills the process but does not guarantee the app is closed and gone. For example trying this on skype would make the app just restart instantly (try it once you are logged into skype). – MindWire Apr 04 '12 at 18:48