Removing unnecessary applications through the standard Android interface is often limited: the system does not allow you to get rid of pre-installed apps, and some "junk" files remain even after uninstallation. Command line via ADB (Android Debug Bridge) opens up advanced options - from complete erasure user applications before deleting system components that are usually blocked.
This method is especially relevant for owners of devices with limited memory or custom firmware, where every megabyte counts. However, working with ADB requires caution: the wrong command can lead to a system crash or loss of functionality (for example, deleting Google services will make it impossible to work with the Play Market). This article provides step-by-step guide for beginners and experienced users, including backup and recovery methods.
Before you begin, make sure that your device USB debugging is enabled (path: Settings โ About phone โ Build number โ tap 7 times to activate developer mode, then return to Settings โ System โ For developers). Without this, connecting to ADB is impossible.
1. Preparation: installing ADB and drivers
To manage Android via the command line, you will need ADB tool from Google, which is included Android SDK Platform-Tools. Download the archive from the official website of Android developers (link) and unpack it into a convenient folder (for example, C:\platform-tools).
For Windows, you will additionally need drivers USB: Suitable for most devices (download from the same SDK). their sites.:
- ๐ Universal drivers: Suitable for most devices (download Google USB Driver from the same SDK).
- ๐ฑ Manufacturer drivers: For brands like Samsung, Xiaomi or Huawei It's better to use official drivers from their websites.
- ๐ Checking the connection: After installing the drivers, connect the phone to the PC and make sure that
Manager devicesthere are no exclamation marks next to the name of your device.
For macOS or Linux installation is simpler - just unzip platform-tools and add the folder path to the environment variable PATH. For example, in the Mac terminal, run:
echo 'export PATH=$PATH:~/platform-tools' >> ~/.bash_profile
source ~/.bash_profile
โ ๏ธ Attention: On devices with MIUI (Xiaomi) or EMUI (Huawei) may require additional debugging permission in the security settings. Without this, ADB will not see the device.
2. Connecting the device and checking the connection
Open a command line (Windows) or terminal (macOS/Linux) and go to the folder with platform-tools. To do this, enter:
cd path_to_folder\platform-tools
For example, for Windows:
cd C:\platform-tools
Now connect the phone via USB and run the command:
adb devices
If the connection is established, you will see the serial number of the device. If not, check:
- ๐ Data transfer mode: On the phone, select
File transfer (MTP), not "Charging". - ๐ Debugging permission: A window asking for permission should appear on the phone screen - confirm it.
- ๐ Cable and port: Use the original USB 2.0 cable and port (USB 3.0 sometimes causes problems).
Original USB cable connected|
Enabled USB debugging|
Drivers for your model are installed|
Phone is unlocked (not in sleep mode)|
The `adb devices` command shows the serial number-->
3. Finding application packages to remove
Before deleting anything, you need to know package name the target application. To do this, use the command:
adb shell pm list packages
This command will list all installed packages. To narrow your search, add a filter. For example, to search for applications from Facebook:
adb shell pm list packages | grep facebook
For Windows, replace grep with findstr:
adb shell pm list packages | findstr facebook
Some popular system application packages:
| Application | Package name | Can I delete |
|---|---|---|
| Google Play Services | com.google.android.gms |
โ No (critical for the system) |
| YouTube | com.google.android.youtube |
โ Yes (can be restored) |
| MIUI Cleaner (Xiaomi) | com.miui.cleanmaster |
โ Yes (not system) |
| Samsung Knox | com.sec.knox.* |
โ ๏ธ Partially (may compromise security) |
โ ๏ธ Attention: Removing packages with names containingandroid,systemmay result k device malfunction. Always check the purpose of the package before deleting!
4. Commands for uninstalling applications
There are two main methods for uninstalling via ADB:
- For custom applications (installed by you):
- For system applications (pre-installed):
adb shell pm uninstall -k --user 0 package_name
Flag -k saves data and application cache (useful if you plan to restore it later). Without this flag, complete removal.
adb shell pm uninstall --user 0 package_name
This command does not delete the apk file from the system, but only hides it from the current user. For complete removal you need rights root.
Examples:
- ๐ฑ Removal Facebook:
adb shell pm uninstall -k --user 0 com.facebook.katana
adb shell pm uninstall --user 0 com.google.android.music
adb shell pm list packages > packages_backup.txt
This will help restore deleted applications, if something goes wrong.-->
5. Uninstalling with root access: risks and opportunities
If your device unlocked (has rights root), you can remove system applications completely, and not just for the current user. To do this, use the command:
adb shellsu
mount -o rw,remount /system
rm -rf /system/app/package_name
rm -rf /system/priv-app/package_name
However, this method is extremely risky:
- ๐ฅ Loss of functionality: Removing critical packages (for example,
com.android.phone) will make the phone inoperable. - ๐ Problems with updates: System updates can restore deleted files or cause conflicts.
- ๐ก๏ธ Security violation: Some applications (for example, Samsung Knox) are related to encryption data.
โ ๏ธ Attention: On devices with Samsung Knox or Google Pixel obtaining root access, the flag may be triggered KNOX 0x1 or blocked Google Pay. Before taking action, check the consequences for your model!
What to do if you deleted a critical application?
If after removing the system package the phone stopped working (for example, the network disappeared or the launcher does not start), try:
1. Reboot into Safe Mode (hold the power button โ "Reboot in Safe Mode").
2. Restore the package via ADB:
adb install path_to_apk
(copy the apk file from a backup or download from a site like APKMirror).
3. If all else fails, reset to factory settings or reflash the device.
6. Recovering deleted applications
If you deleted an application by mistake, you can restore it in several ways:
- Through the Play Market: Simply find the application and install it again (works only for user apps).
- Via ADB: If you have a backup copy of the APK, use:
- Via TWRP: If you have a custom recovery, you can restore the system image from a backup.
adb install file_name.apk
For system applications removed by the command --user 0, just run:
adb shell cmd package install-existing package_name
If this method does not work, try resetting the application settings:
adb shell pm clear package_name
7. Alternative methods: without the command line
If working with ADB seems difficult, consider alternatives:
- ๐ฑ Debloater applications: Universal Android Debloater (GUI for ADB) or Package Disabler (for Samsung) allow you to disable applications without commands.
- โ๏ธ Custom firmware: Firmwares like LineageOS or Pixel Experience come without pre-installed garbage.
- ๐ง ADB AppControl: A utility with a graphical interface for managing packages (available on GitHub).
However, even these methods require unlocking the bootloader or superuser rightswhich will void the warranty on most devices. Always weigh the risks!
Removing via ADB is the most effective way to get rid of system software, but requires caution. Start with commands --user 0rather than a complete erase to minimize risks.
FAQ: Frequently asked questions
Is it possible to remove Google Play Services?
No, this will crash most applications, including the Play Market. The maximum is that you can disable auto-updates or delete updates for it:
adb shell pm uninstall -k --user 0 com.google.android.gms
But even this can cause errors in the operation of the device.
Why does the application appear again after deletion?
Some system applications are restored after an OTA update. To avoid this:
- Disable auto-updates in system settings.
- Use Magisk or Xposed to block recovery.
How to delete applications on Android without root?
Without root you can:
- Delete user applications via
adb uninstall. - Disable system applications with command
adb shell pm disable-user --user 0 package_name.
Complete removal of system packages is only possible with root access.
Is it safe to use ADB on an unlocked phone?
Yes, if you do not remove system components. Commands with the flag --user 0 do not affect the system partition, so the risk of โbrickingโ is minimal. However:
- Always check the package name before deleting.
- Do not delete something whose purpose you do not understand.
How to find out which application belongs to a package?
Use the command:
adb shell dumpsys package package_name
Or install App Inspector from the Play Market - it shows the package names for all installed apps.