
Android package management ADB commands: Manage Android packages through ADB, including install/uninstall, package inventory and APK path inspection. Data-clearing actions are marked as destructive. This guide explains what each command does, its syntax, practical examples, useful options, and common mistakes. Commands are shown for typical installations; flags can vary across operating-system and tool versions.
Before you start
Open a terminal appropriate for the operating system shown in the examples. Check that the required tool is installed and that you are running it with the permissions needed for your task. Replace sample names, paths, hostnames and IDs with values from your own environment.
Syntax at a glance
Square brackets usually indicate optional arguments, while uppercase words such as FILE, HOST and PACKAGE are placeholders that you replace. Keep quotes around paths or text that contains spaces. Commands should be tested on a safe sample before being used in production.
Quick command reference
| Command | What it does | Example | Useful options |
|---|---|---|---|
adb install | Install an APK package | adb install -r app.apk | -r reinstalls while retaining data where allowed; -t allows test APKs |
adb uninstall | Remove an installed package for the current user/device | adb uninstall com.example.app | -k keeps data/cache on supported workflows |
pm list packages | List installed package names in device shell | adb shell pm list packages -3 | -3 lists third-party packages; -s lists system packages |
pm path | Show APK path for an installed package | adb shell pm path com.example.app | Multiple paths can appear for split APKs |
pm clear | Clear app data and cache | adb shell pm clear com.example.app | No undo option exists for cleared application data |
Command syntax and examples explained
1. adb install
Purpose: Install an APK package.
Syntax
adb install app.apkExample
adb install -r app.apkOptions and notes: -r reinstalls while retaining data where allowed; -t allows test APKs.
APK signing and Android version constraints can prevent installation.
2. adb uninstall
Purpose: Remove an installed package for the current user/device.
Syntax
adb uninstall PACKAGEExample
adb uninstall com.example.appOptions and notes: -k keeps data/cache on supported workflows.
Uninstalling may delete local app data; back up important information first.
3. pm list packages
Purpose: List installed package names in device shell.
Syntax
adb shell pm list packagesExample
adb shell pm list packages -3Options and notes: -3 lists third-party packages; -s lists system packages.
Package IDs are not always the same as app display names.
4. pm path
Purpose: Show APK path for an installed package.
Syntax
adb shell pm path PACKAGEExample
adb shell pm path com.example.appOptions and notes: Multiple paths can appear for split APKs.
This is read-only and useful when confirming whether an app is installed.
5. pm clear
Purpose: Clear app data and cache.
Syntax
adb shell pm clear PACKAGEExample
adb shell pm clear com.example.appOptions and notes: No undo option exists for cleared application data.
High impact: this resets the app like a fresh install and may remove locally stored content.
Common mistakes and troubleshooting
- Command not found: confirm the tool is installed and available on your PATH; open a new terminal after changing PATH.
- Permission denied: verify the current account, file permissions and target path. Use administrator/root privileges only when genuinely required.
- Unexpected output: check the command version, quoting, current directory and exact arguments. Consult the local help or manual for options supported by your build.
- Destructive operations: preview the target and keep a backup before deleting data, rewriting history, flashing a partition or changing system configuration.
Safety tips
Review every command before running it, especially commands that delete files, change permissions, flash firmware, alter a database or expose a network service. For network scanning and remote administration, work only on devices and systems you own or are authorized to test. Keep credentials, private keys, access tokens and log files private.
Frequently asked questions
Do these commands work on every system?
Not always. Some commands are specific to Windows, Linux, Android, a particular package manager or an installed tool version. Use the syntax shown for your platform and check local help when a flag is unavailable.
Can I copy and run every example exactly?
Use the examples as templates. Replace placeholders such as filenames, package IDs, hostnames and paths with your own values, and verify the effect before executing a command that changes data or system state.
Conclusion
Use this reference as a starting point, then confirm flags in the tool’s official help or manual for your installed version. A clear understanding of syntax, options and side effects makes command-line work more reliable.