I try to run
adb shell kill 5539
where 5539
is a process id found when running adb shell ps
, but I get
/system/bin/sh: kill: 5539: Operation not permitted
How can I rectify my permissions?
This is the only adb documentation on kill:
kill [options]
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 | all | current: Specify user whose processes to kill; all users if not specified.
Enable adb debugging on your device On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom.
Make sure USB debugging is enabled and USB is physically plugged in. Make sure everything is ok with the ADB drivers, double-check the device manager. Check if the device appears in "adb devices", make sure its authorized on the device. Try actual adb shell and other relevant adb stuff.
Open a command window in the folder by holding shift and right-clicking in an empty spot in the folder and selecting "Open command prompt/PowerShell here" in the menu. Then you can start using ADB — connect your phone and try .
My methods:
Without root
adb shell am force-stop <package name>
I don't know how to do it with PID, kill <PID>
and kill -9 <PID>
don't work in my case
With root
I have also installed BusyBox to get more UNIX tools on my device
adb shell "su -c 'kill $(pidof <package name>)'"
or
adb shell "su -c 'kill <PID>'"
You need to restart adb as root
This will give you permissions to kill the process.
$ adb root
$ adb shell kill 5539
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With