I am developing an app, and for debugging certain actions on first installation I found that using the terminal command:
./adb uninstall <package-name>
was a lot fast than navigating to settings, apps, waiting for the apps to load, finding your app, and uninstalling it. I would strongly recommend it for anyone that doesn't already use it for debugging.
Now I am trying to work on the force close part of my app, and I can't find anywhere in the android doc, instructions on how to force close an app by adb command.
Is it possible?
am force-stop YOUR.PACKAGE.NAME
This command worked for me. Hope so this will help you as well.
You can use adb shell kill
to kill the process, but first you need to find the process id. To do this you can use adb shell ps
and parse the output. Here is a sample (assuming your development PC is Unix):
adb shell kill $(adb shell ps | grep YOUR.PACKAGE.NAME | awk '{ print $2 }')
You can close one by his pid using
adb shell kill <PID>
but I'm not sure of doing it with a package name.
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