I'm trying to stop application on Android 2.3.7 device. But in this version of Android I can't use "force-stop" command. Do you know any other ways to close application on non rooted device?
4 Answers
The first way
Requires root
Use kill
:
adb shell ps
=> Will list all running processes on the device and their process ids
adb shell kill <PID>
=> Instead of <PID>
use process id of your application
The second way
In Eclipse open DDMS
perspective.
In Devices
view you will find all running processes.
Choose the process and click on Stop
.
The third way
It will kill only background process of an application.
adb shell am kill [options] <PACKAGE>
=> Kill all processes associated with (the app's package name). This command kills only processes that are safe to kill and that will not impact the user experience.
Options are:
--user <USER_ID> | all | current: Specify user whose processes to kill; all users if not specified.
The fourth way
Requires root
adb shell pm disable <PACKAGE>
=> Disable the given package or component (written as "package/class").
The fifth way
Note that run-as is only supported for apps that are signed with debug keys.
run-as <package-name> kill <pid>
The sixth way
Introduced in Honeycomb
adb shell am force-stop <PACKAGE>
=> Force stop everything associated with (the app's package name).
P.S.: I know that the sixth method didn't work for you, but I think that it's important to add this method to the list, so everyone will know it.

- 2,408
- 5
- 16
- 31

- 11,889
- 4
- 38
- 76
-
3Thanks for answer but when I use `kill` I get "Operation not permitted" error. My device is non rooted and I have to do this via ADB. – Erdem Ergin Jul 24 '13 at 09:20
-
3I used the sixth one. Works like a charm. I used it to stop the main app then do a factory reset and reinstall. This little script might be useful (semi-colons indicate line breaks, replace them): adb shell am force-stop
; adb shell wipe data; adb shell wipe cache; adb reboot recovery; TIMEOUT 80 /nobreak; adb install – Batdude Jan 01 '14 at 20:08; -
what kind of way is equivalent to the user going to the app details and choose "force stop" ? is the 6th one? also, how do you make an app become in "stopped" state , which mean it doesn't get any intent, any event whatsoever, till the user opens the app? – android developer Jan 29 '14 at 00:26
-
7Thanks for including #6, nowadays most people will be targeting above honeycomb. This worked exactly right for the scripts I'm writing: adb shell am force-stop
– Matt Dec 02 '14 at 20:44 -
How can I do this programmatically from my application? Any example code would be more helpful.. – anddev Mar 09 '15 at 08:39
-
FYI about run-as command, the complete structure is """adb exec-out run-as com.abc(pkg name) kill 31736(pid)""" – 100RaBH Nov 05 '19 at 06:55
-
1operation not permitted... what is that means...? do i need root? – gumuruh Jul 11 '20 at 01:10
-
1@gumuruh I got this "operation not permitted". This seems to require a rooted device. However the sixth option, `adb shell am force-stop
` worked. – Stephen Hosking Feb 02 '23 at 08:25
If you have a rooted device you can use kill
command
Connect to your device with adb:
adb shell
Once the session is established, you have to escalade privileges:
su
Then
ps
will list running processes. Note down the PID of the process you want to terminate. Then get rid of it
kill PID

- 35,493
- 19
- 190
- 259

- 103
- 2
- 7
-
1if the process keeps running even after got killed. What should i do then? @EricVB – gumuruh Dec 19 '16 at 08:53
If you want to kill the Sticky Service,the following command NOT WORKING:
adb shell am force-stop <PACKAGE>
adb shell kill <PID>
The following command is WORKING:
adb shell pm disable <PACKAGE>
If you want to restart the app,you must run command below first:
adb shell pm enable <PACKAGE>

- 7,054
- 3
- 33
- 38
-
-
Just like you, the `am force-stop
` command was not working for me... So I ended up using the `pm disable – rugby2312 Jan 22 '21 at 04:21` , and `pm enable ` combination ... However , since I also needed to launch the app, I added an extra command line `monkey -p -c android.intent.category.LAUNCHER 1`