Privacy

Removing apps & packages using Android Debug Bridge (adb)! Bloatware on new android devices

Image Credit: Microsoft Copilot & OpenAI Dall-E 3

This is part three of a three part series on the bloatware problem that plagues Samsung Galaxy smartphones & Android in general.

Part one dove into the nuisance that pre-installed apps and ads are, and part two covered how so many of Samsung's apps are not user removable and even the apps that were removed conveniently left behind some of its packages.

We will now dwelve into the cool piece of software that is Android Debug Bridge (adb), and how we can force uninstall some of the more stubborn apps.


Setting up Android Debug Bridge (adb)

Android debug bridge (adb) is a super niffy command line tool that gives you deep access to the Android operating system.

It lets you issue commands from your desktop environment and run them on your Android device.

It is a part of the overall Android Studio IDE from Google.
Here are the official instructions from Google for downloading & installing Android Studio: Install Android Studio.

To use adb, you will need to enable USB debugging under developer options on your phone. This is usually turned off by default (and for very good reasons).

The steps to enable this will vary for each mobile OEM, so I'm linking here the official instructions from Google on how to enable it: Enable adb debugging on your device


A quick word of caution before proceeding with adb

Developer options, USB debugging and adb are tools for power users. And with great power comes great responsibility (cliché, I know, sorry).

They offer you unrestricted access to the core of the Android OS, which means that it's quite easy to irrecoverably break things - something that you wouldn't have been able to do when using the phone normally. Or install nasty malware.

Please be very thoughtful and picky in the commands you choose to run and take a step back if things aren't working out the way you are expecting them to.

Enabling developer options also opens up your phone to potential security issues like malware if you aren't careful about the commands you are running.

So unless you have a valid use case for it and know exactly what you are doing, please disable developer options once you are done using adb.
Developer options is always disabled on my own Android device.


Using adb to uninstall apps

We are ready to rock with adb once you have:

  • Install Android Studio on your desktop environment
  • Enable USB debugging on your Android device environment
  • Connect your Android device to the desktop via a USB cable
  • Open up the terminal (Linux & Mac) or command prompt (Windows) and run adb

Run the following commands:

Step #1: Check if adb is able to reach your Android device via USB:

adb devices

A successful output should be something like:"List of devices attached: (random alpha-numeric code) device"

Step #2: Enter the Android devices shell via adb:

adb shell

A successful output should change your terminal prompt.
We are now running commands directly from the Android device's shell.

Step #3: See a list of all packages installed on the Android device:

pm list packages

A successful output should show you a significantly long list of package names.

Here's the list of packages on my device:

Phew, that's a lot!
Essentially every package installed on your Android device is listed here.

Step #4: Identifying specific packages that you'd like to remove (e.g. packages from Facebook)

Let's narrow down the list to only packages to only the ones with the term "facebook" in them.
This can be done using 'grep' (works on Linux & Mac. Not sure about an equivalent command for the command line in Windows)

pm list packages | grep facebook

Here's what my output looks like:

The following are packages from Facebook (or at least the ones with 'facebook' in their name)
package:com.facebook.services
package:com.facebook.system
package:com.facebook.appmanager

Step #5: Uninstalling the packages

Run the following command to remove the package permanently from your Android device.

pm uninstall --user 0 (package_name)

Replace '(package_name)' with the package of your choice.
Each run should give you an output 'Success'.

Here are the commands I ran to remove the 3 facebook packages we narrowed down in the last step:
pm uninstall --user 0 package:com.facebook.services
pm uninstall --user 0 package:com.facebook.system
pm uninstall --user 0 package:com.facebook.appmanager

And here's how my terminal output looks like:
ADB-pm-uninstall-facebook

And a few more commands and their results:

pm list packages | grep microsoft
pm uninstall --user 0 com.microsoft.appmanager
pm uninstall --user 0 com.microsoft.skydrive
ADB-pm-uninstall-microsoft

pm list packages | grep netflix
pm uninstall --user 0 com.netflix.partner.activation
pm uninstall --user 0 com.netflix.mediaclient
ADB-pm-uninstall-netflix

Success (finally!)
Use the same method to identify and remove any more of those pesky & stubborn apps that you aren't fond of.

More power to you!

And oh, a reminder to please turn off developer options on your Android once you are done with adb. :)


Closing comments

This article was the final one in a three part series. Sufficient to say, Android's open nature allows us users to wrestle back some control of our own devices.

You may have noticed above that I went about uninstalling packages from Facebook, Microsoft and Netflix but not others like Google or Samsung.
This is by choice, because unfortunately I do not yet possess the expertise to identify which of the said packages are non-system critical.

Google offers the majority of the services for Android, and Samsung, being the OEM for my device, will surely have a number of important packages that are system critical.

And it will be trivial to remove a system critical package that breaks major parts of the OS. So I haven't dipped my toes in this yet.

Something for the future maybe?

A couple of quick caveats

  • Technically it is possible to connect to your Android device via Wi-Fi (and not just USB). Google's page on adb linked above includes instructions for this.
  • Uninstalling apps is only a tiny fraction of what adb is capable of.
  • This post is not intended to be an exact step-by-step guide for using adb to uninstall apps.
    Such detailed instructions are a simple web search way, should you need one.
    Here's a relatively nice one from XDA developers: How to Uninstall Carrier/OEM Bloatware without Root Access.
  • I've seen other guides run commands via just adb and not when logged directly into shell via adb, but I personally have had mixed results with this. Your mileage may vary.