Debloat Android
This article goes over using ADB Platform Tools and utilizing adb to uninstall packages by using these tools.
Pre-Requisites for Using ADB
Setup all of the following to use ADB
Setup Computer with ADB Platform Tools
- Windows Install with Chocolatey
choco install adb - Linux Install with Terminal
sudo apt-get install android-tools-adb android-tools-fastboot - MacOS Install with Homebrew
- Homebrew install -
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - ADB Homebrew Install -
brew cask install android-platform-tools
- Homebrew install -
Setup Phone for ADB Debugging
- Open Settings, and select “About”.
- Tap on “Build number” seven times.
- Go back, and select “Developer options”.
- Scroll down, and check the “Android debugging” or “USB debugging” entry under “Debugging”.
- Plug your device into your computer.
- On the computer, open up a terminal/command prompt and type adb devices.
- A dialog should show on your device, asking you to allow usb debugging. Check “always allow”, and choose “OK”.
- Note: If you don’t see this prompt on you device change the usb connection to MTP or File Transfer on the device
ADB Commands - These only work when device is booted
adb devices- shows all connected adb devicesadb shell- launches a shell on the deviceadb shell pm list packages- list all installed packages on the deviceadb shell pm list packages -3"|cut -f 2 -d ":- lists all user installed packagesadb push <local> <remote>- pushes the fileto adb pull <remote> [<local>]- pulls the fileto . If isn’t specified, it will pull to the current folder. adb logcat- allows you to view the device log in real-time. You can use adb logcat -b radio to view radio logs, and adb logcat -C to view logs in colouradb install <file>- installs the given .apk file to your deviceadb uninstall com.packagename- uninstalls package from shell pm list packages- Note: if you encounter “[DELETE_FAILED_INTERNAL_ERROR]” type this to bypass:
adb shell pm uninstall --user 0 <appname>
- Note: if you encounter “[DELETE_FAILED_INTERNAL_ERROR]” type this to bypass:
adb reboot- reboots systemadb reboot bootloader- reboots to bootloaderadb reboot recovery- reboots into recovery modeadb reboot fastboot- reboots into fastboot mode
Fastboot Commands - These commands work when device is in Bootloader and Fastboot Mode
fastboot devices- shows all connected devicesfastboot reboot- reboots device - can add bootloader, recovery, and fastbootfastboot oem device-info- shows oem bootloader status (unlocked or locked)fastboot oem unlock- unlocks oem phones - note: aosp and unlocked phones don’t need thisfastboot flashing unlock- unlocks system for custom rom in pixel and other phonesfastboot flashing unlock_critical- unlocks bootloader and system partitions - note: this isn’t generally neededfastboot format:ext4 userdata- format userdata on device - note: this will erase your entire devicefastboot boot recovery.img- test recovery image without flashingfastboot flash recovery recovery.img- flash recovery image then runfastboot reboot recoveryto boot into it.fastboot flash boot boot.img- flash boot image - this is the kernelfastboot -w- wipes devicefastboot update </path/to/your/Rom.zip>- flashes zip to the device