Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to kill native applications from 'adb shell'?

Tags:

android

adb

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?

like image 576
RanjitRock Avatar asked Feb 16 '12 06:02

RanjitRock


People also ask

How do I start and kill adb server?

Stop the adb server In some cases, you might need to terminate the adb server process and then restart it to resolve the problem (e.g., if adb does not respond to a command). To stop the adb server, use the adb kill-server command. You can then restart the server by issuing any other adb command.

How do I delete system files using adb?

To remove the app go into your Android device's shell by running adb shell . Once there, run pm uninstall -k --user 0 package.name (replacing package.name with the name of the package you searched for earlier). You can also run adb shell pm uninstall -k --user 0 package.name if you choose.

What are adb shell commands?

Android Shell Commands. ADB is Android Debug Bridge which is a command line utility included with Google's Android SDK. It provides a terminal interface to control your Android device connected to a computer using a USB. ADB can be used to run shell commands, transfer files, install/uninstall apps, reboot and more.


2 Answers

adb shell am force-stop packagename
like image 117
Tema Avatar answered Sep 21 '22 17:09

Tema


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.

like image 22
Julian Fondren Avatar answered Sep 17 '22 17:09

Julian Fondren