This script allows you to remove or disable pre-installed or unwanted apps from your Android device using ADB. It automates the process by:
- Starting the ADB server.
- Ensuring the device is authorized.
- Checking if apps are installed before attempting to uninstall or disable them.
- Trying to uninstall the app first; if that fails, disabling it.
Ensure that ADB (Android Debug Bridge) is installed on your system. Below are the installation instructions for different Linux distributions:
sudo pacman -S android-tools android-udevRead more: ArchWiki - Android Debug Bridge
sudo apt update
sudo apt install android-tools-adbsudo dnf install android-toolsInstall the adb package using your package manager or download the Android SDK Platform Tools from the official website.
-
Clone or download the script:
git clone https://github.com/thienandangthanh/uninstall-android-apps.git cd uninstall-android-apps -
Make the script executable:
chmod +x uninstall.sh
-
Connect your Android device via USB and enable USB Debugging from the Developer Options.
-
Run the script:
./uninstall.sh
- The script will:
- Start the ADB server if not already running.
- Prompt you to authorize your computer if your device is not already trusted.
- Attempt to uninstall each app listed in the script for the current user (
pm uninstall --user 0). - If uninstallation fails, it will disable the app (
pm disable-user --user 0).
-
Open the script in a text editor:
vim uninstall.sh
-
Modify the
apps_to_removearray to include the package names of the apps you want to process:apps_to_remove=( "com.example.app1" "com.example.app2" )
If you need to re-enable an app that was previously disabled:
-
Check the list of disabled apps:
adb shell pm list packages -d
-
Enable the desired app:
adb shell pm enable com.example.app -
To enable all disabled apps:
adb shell pm list packages -d | awk -F':' '{print $2}' | while read pkg; do adb shell pm enable "$pkg"; done
-
If no device is detected, ensure USB Debugging is enabled and run:
adb devices
Authorize the computer if prompted.
-
If the app is critical or part of the system, it may not be removable or disable-able without root access.
- Use this script with caution. Removing or disabling critical system apps may cause unexpected behavior on your device.
- This script is provided as-is without any warranty.