How to install an APK with adb from a computer
Advertisement
When adb is the better tool
Installing from a computer avoids the phone's installer entirely, shows the real error code when something fails, handles split bundles without a third-party app, and is the only way to install on Android TV boxes without a file manager.
Setup
- Get the platform tools:
brew install --cask android-platform-toolson macOS,sudo apt install adbon Debian and Ubuntu, or download SDK Platform-Tools from Google for Windows and unzip it. - On the phone, enable Developer options by tapping Build number in Settings › About phone seven times, then turn on USB debugging.
- Connect the cable, run
adb devices, accept the prompt on the phone. The device should list asdevice, notunauthorized.
Wireless: Android 11 and later have Wireless debugging in Developer options with a pairing code; adb pair <ip:port> then adb connect <ip:port>.
Commands
| Task | Command | |
|---|---|---|
| Install an APK | adb install app.apk | |
| Reinstall keeping data | adb install -r app.apk | |
| Install a split bundle | adb install-multiple base.apk split_config.arm64_v8a.apk split_config.en.apk | |
| Install an XAPK or APKS | Extract it first (it is a zip), then install-multiple on the APKs inside | |
| Install to a specific user | adb install --user 0 app.apk | |
| Uninstall | adb uninstall <package name> | |
| Check the installed version | `adb shell dumpsys package <package name> \ | grep version` |
Downgrades
adb install -r -d app.apk allows a lower version code on debuggable builds only; on a normal app the -d flag is ignored and the install fails with INSTALL_FAILED_VERSION_DOWNGRADE. Uninstall first, as described in how to downgrade an app.
Reading errors
adb prints the reason, unlike the phone's installer: INSTALL_FAILED_UPDATE_INCOMPATIBLE is a signature mismatch, INSTALL_FAILED_NO_MATCHING_ABIS means the package has no native code for your CPU, INSTALL_FAILED_OLDER_SDK means the app needs a newer Android, INSTALL_FAILED_MISSING_SPLIT means you installed the base APK of a bundle alone.
OBB data
adb does not place expansion files. Copy them with adb push main.1234.com.example.obb /sdcard/Android/obb/com.example/.
This guide describes general Android behaviour; menu names vary by manufacturer and Android version. Downloads on this site come from established third-party mirrors and are never modified by us.