Uninstall Apps with ADB

Main Source Link

Note: Uninstalling some system apps can be dangerous and may result in force closes or even a bricked device. An app may depend on another app to work so be careful about what you uninstall and the consequences it may have. It's best not to mess with some core apps like the dialer, messages, camera, etc., and only uninstall the apps you consider bloatware.
Use ALL of the software mentioned on this page AT YOUR OWN RISK. No one is responsible for bricked devices, or other similar damages.

Step 1: Enabling USB Debugging on your phone
  1. Open the Settings app on your phone and scroll down to About Phone.
  2. Tap on the Build Number seven times to enable Developer Options.
  3. Go back to the Settings menu and go to System > Developer Options.
  4. Enable USB Debugging.
Step 2: Interfacing your phone with ADB
  1. Plug your phone into your computer and change the USB settings from Charge only mode to File transfer (MTP) mode.
  2. Ensure that you have ADB installed on your computer.
  3. On your computer, browse to the directory where ADB is installed. Hold the Shift key and right-click on the name of the directory and select Open command/PowerShell window here.
  4. If you're using a Mac, launch a Terminal window and navigate to the ADB directory using cd "path to the directory" (without the "").
  5. Now, type in adb devices and hit enter.
  6. You will see the system is starting the ADB daemon. If this is your first time running ADB, you'll see a prompt on your phone asking you to authorize a connection with the computer. Grant it.
  7. Now, if you re-run the adb devices command, the terminal will print the serial number of your device. If you see a string of numbers, you're ready to move on.
Step 3: Finding the name of the packages to uninstall
  1. In the command prompt/terminal window, enter adb shell and hit enter.
  2. Then, use the following command:
    pm list packages | grep '<.OEM/Carrier/App Name>'
    without the dot before OEM.
  3. This will list all the OEM and carrier apps installed on your device.

Alternatively, you can also use an app called App Inspector from the Play Store to know the package names of all the installed apps on your phone. Install the app, select the app you want to uninstall, and the package name will be listed there. Note the package names of all the apps you want to uninstall. You can get App Inspector from here, it's free: Playstore Link. There's also App Manager from F-Droid that has similar functionalities.

Step 4: Uninstalling the bloatware

This is the command you need to use to uninstall a system app:

pm uninstall -k --user 0 NameOfPackage

Note that NameOfPackage needs to be replaced with the full package name, without any " or <>. You'll also need to execute the command for every app you want to uninstall.

As a word of warning, uninstalling system applications can be dangerous so please know what you're getting rid of before you complete these steps. Failing to do so could result in your phone becoming unusable until you perform a factory reset. Of course, by removing any given system application, another system application that may depend on it may also break so be careful what you remove. If something goes wrong, you can always perform a factory reset to bring things back to the way they were. Alternatively, there's an even easier way to bring back an app you uninstalled, as we explain in the section at the end.

Note 1: How to re-install an uninstalled app

If you've deleted an app by mistake or a secondary app is force closing because it's dependent on an app you uninstalled, you can re-install the app using the following set of commands:

adb shell pm install-existing NameOfPackage

This works because applications truly aren't fully uninstalled from your device. They are just being uninstalled for the current user (user 0 is the default/main user of the phone). That's why, if you omit the --user 0 and -k part of the uninstall command, the command won't work. These two flags respectively specify the system app will only be uninstalled for the current user (and not all users, which is something that requires root access) and that the cache/data of the system application will be preserved (which can't be removed without root). Therefore, even if you uninstall a system app using this method, you can still receive official OTA updates from your carrier or OEM.

Note 2: Safe to Remove Apps

This part isn't from the article. You can see what system apps are safe to remove from couple of threads found on XDA Forums. Users have put time and effort to test and inform you which ones are safe to remove, below are some of these posts.