G33K-TRICKS: How to remove an Application (apk) from an Android Phone using command

Saturday, September 5, 2015

How to remove an Application (apk) from an Android Phone using command


Simple steps to Remove APK using Command line


Have you ever want to remove an android app from your own android device and that stubborn thing  just don't want to leave your device.
Yeah!!! its simple to Remove right, you can just  go to Settings > Apps and Uninstall

What if you can 
First you need to have and Rooted Phone. If its not rooted, then you are in little deep trouble.

Connect you phone to your PC/Laptop
If your PC  already have phone's drivers, you can see your Phone getting mounted in My Computer

Next you need an adb utility. If you don't have get it from here.

Once connected,
Open CMD prompt and goto the path where you have kept the adb utility.

Now type, adb devices and hit enter
e.g
C:\My Downloads> adb devices

This command will return the serial number of your phone. If it does not return anything in that case, you need to enable the USB Debugging from the "Developer Settings" .
[ And again, if you dont have Developer option not available in your Settings, goto Settings > About Phone> tap 5/7 times on "Build Number" and it will be available under Settings ] 

After getting assured that the phone is connected via adb.
type , adb root

C:\My Downloads> adb root

On rooted phone, an pop up will appear asking for root permission. It depends on which app you have used to permit ownership as "Super User".
Grant the permission from the phone.

Now type, adb shell

This will take you to the android shell (which is ofcourse linux based, and if you have busybox binary installed in your phone , you can do much more with this tool)

Now from the shell prompt type, cd /data/app
This will take you to user apps folder.
the path would look like,















Screen-shot  (In my case, I went to adb shell first and then ran "su" command to get the root permission.)

Now type,
root@xyz: ls | grep -i "<appname_to_remove>"

Say, the app name is "whatsapp"

root@xyz: ls | grep -i "whatsapp"

This will result in getting, the list of app(s) with the app you want to remove.
If you have given a proper apk name. The ls command will list it.

Then just remove that app, thats all

 root@xyz: rm com.<appname_to_remove>.apk


Remove apk usng command line









You have to remove only the app which is shown in the list after ls | grep -i <> and please make sure the app name which you are removing is correct. Coz, once gone is gone when you remove it using rm command.

After this, just reboot the phone using Power key or type, adb reboot




Search Queries:
How to remove app using command
app not getting removed from android phone

No comments: