adb-install
Install application packages on Android devices
TLDR
Push an Android application to an emulator/device
Push an Android application to a specific emulator/device (overrides $ANDROID_SERIAL)
[r]einstall an existing app, keeping its data
Push an Android application allowing version code [d]owngrade (debuggable packages only)
[g]rant all permissions listed in the app manifest
Quickly update an installed package by only updating the parts of the APK that changed
SYNOPSIS
adb install [options] path_to_apk
PARAMETERS
-r
Reinstall. Replaces an existing application, preserving its data if possible.
-t
Allow test packages. Permits the installation of APKs that declare themselves as test-only (e.g., debug builds).
-s
Install to shared storage. Attempts to install the application on shared/external storage (like an SD card) if the device supports it.
-d
Allow version downgrade. Enables installing an older version of an application over a newer one without requiring uninstallation first.
-g
Grant all runtime permissions. Automatically grants all runtime permissions requested by the application upon installation.
-k
Keep data and cache. When used with -r (reinstall), prevents the application's data and cache from being cleared during the update process.
--user
Install for specific user. Installs the application for a designated user profile on multi-user Android devices.
path_to_apk
Path to APK file. The mandatory argument specifying the full or relative path to the Android Package Kit (.apk) file on your host machine.
DESCRIPTION
The adb install command, part of the Android Debug Bridge (ADB) suite, is a fundamental tool used to deploy Android application packages (APKs) onto connected Android devices or emulators. It streamlines the process of transferring an application's executable file from a host machine to the target device and initiating its installation.
Primarily, adb install is indispensable for Android developers, enabling rapid testing, debugging, and iteration during the application development lifecycle. Beyond development, it's widely used for sideloading applications that are not available through official app stores or for installing custom builds. The command handles various installation scenarios, including fresh installs, reinstalling existing applications (optionally preserving data), downgrading app versions, and installing applications for specific users or storage locations. Successful execution requires USB debugging to be enabled on the Android device, the device to be properly connected and authorized, and the ADB server to be running on the host machine.
CAVEATS
Caveats:
USB Debugging: Must be enabled in the Developer options on the Android device.
Device Connection: The device must be physically connected (via USB) and authorized with the host machine. Use adb devices to verify.
ADB Server: The ADB server must be running on your host machine. It usually starts automatically with the first adb command.
Storage Space: Insufficient storage space on the device will cause installation failure.
APK Validity: The provided APK file must be valid, uncorrupted, and signed.
Security Prompts: On some Android versions, you might need to manually confirm installation or grant permissions to install from unknown sources.
APK (ANDROID PACKAGE KIT)
An APK is the package file format used by the Android operating system for distribution and installation of mobile applications and middleware. It is analogous to .exe files on Windows or .dmg files on macOS. An APK file contains all elements that an application needs to install correctly on a device, including code, assets, resources, certificates, and manifest files.
PACKAGE MANAGER (PM)
On Android, the Package Manager (PM) is a system service responsible for installing, uninstalling, and managing applications. When you use adb install, ADB communicates with the device's pm service to perform the actual installation. You can also directly interact with the pm command via adb shell pm install for more granular or specific installation scenarios, though adb install simplifies the most common use cases.
HISTORY
The adb install command has been a core component of the Android Debug Bridge (ADB) utility since the very early days of the Android SDK. Its fundamental purpose of deploying applications to devices made it an essential tool for Android developers from the outset. Over time, as the Android operating system evolved and introduced new features like multi-user support, runtime permissions, and different app installation mechanisms (e.g., split APKs, APEX), various options and flags were progressively added to adb install to accommodate these capabilities and provide more granular control over the installation process.
SEE ALSO
adb uninstall(1), adb push(1), adb devices(1), adb shell pm install(1)