Deploy Android with ADB
Goal
Build, test, install, and verify an Android application on the intended phone, tablet, emulator, TV, or Wear OS device.
Input
A project checkout, deployment intent, optional ADB serial or wireless-debugging endpoints, and the expected package IDs.
Output
Verified build artifacts and package installations, or a precise build, pairing, target-selection, install, or verification failure.
Select the target
- Read the project's instructions and maintained build/deploy entry points before constructing commands.
- Run
adb devices -l and consider only entries whose state is exactly device.
- Preserve the complete serial left of the first tab before the device state as one quoted argument. Wireless mDNS serials can contain spaces and need not resemble
HOST:PORT.
- Confirm candidates with properties such as
ro.product.model, ro.product.name, and ro.build.characteristics. Match the requested device class instead of guessing from its address.
- Use a supplied serial only after confirming that exact target is online. If multiple candidates remain, ask the user which one to use.
Wireless debugging
Prefer a project's maintained pairing helper when one exists. Otherwise use fresh endpoints shown by Android's Wireless debugging screen:
adb pair HOST:PAIR_PORT
adb connect HOST:ADB_PORT
Treat the pairing port and normal ADB port as distinct. Enter the pairing code only at ADB's interactive prompt.
Diagnose discovery with adb mdns services, adb devices -l, and adb server-status. Restart the local daemon only when its state is stale.
If trust was removed on the device, pair again. Do not delete ADB keys or alter network security settings without explicit approval.
Build and install
Run the project's required tests and maintained debug or deployment build. Stop on any failed contract, test, or build.
Identify artifacts and package IDs from build configuration or manifests; do not infer them solely from filenames.
Prefer a maintained deployment command that verifies its work. Otherwise install a single APK with:
adb -s "$serial" install -r "$apk"
Use install-multiple -r for a validated split-APK set. An Android App Bundle is not directly installable; use the project's supported APK-generation path.
Verify every expected package independently:
adb -s "$serial" shell pm path "$package_id"
Launch or configure the app only when requested. Report the target model, build/test result, artifact, install result, and package verification.
StarIntel Wear OS recipe
When the checkout exposes the StarIntel Nix apps, build all modules and let the maintained installer deploy and verify the Wear app plus watch face:
nix run .#build-all
nix run .#install-watch -- "$serial"
The expected watch packages are actor.starintel.wear and actor.starintel.watchface. Never install the phone APK on a watch.
Rules
- Never hard-code a serial, private address, port, pairing code, APK path, or package ID as a universal default.
- Prefer an exact online serial from
adb devices over a stale remembered endpoint.
- Preserve user data with
-r unless the user explicitly requests a clean reinstall.
- After source updates or a request to deploy "again," rebuild before installing.
- Do not report success from pairing, an open TCP port, or
adb install alone; verify the expected packages.
1---2name: android-adb-deploy3description: android, adb, wireless-debugging, apk, build, deploy, wearos4compatibility: Requires Android platform-tools and the target project's declared build dependencies.5metadata:6 source: https://skillmd.com/skills/lost-rob0t/android-adb-deploy7---89# Deploy Android with ADB1011## Goal1213Build, test, install, and verify an Android application on the intended phone, tablet, emulator, TV, or Wear OS device.1415## Input1617A project checkout, deployment intent, optional ADB serial or wireless-debugging endpoints, and the expected package IDs.1819## Output2021Verified build artifacts and package installations, or a precise build, pairing, target-selection, install, or verification failure.2223## Select the target24251. Read the project's instructions and maintained build/deploy entry points before constructing commands.262. Run `adb devices -l` and consider only entries whose state is exactly `device`.273. Preserve the complete serial left of the first tab before the device state as one quoted argument. Wireless mDNS serials can contain spaces and need not resemble `HOST:PORT`.284. Confirm candidates with properties such as `ro.product.model`, `ro.product.name`, and `ro.build.characteristics`. Match the requested device class instead of guessing from its address.295. Use a supplied serial only after confirming that exact target is online. If multiple candidates remain, ask the user which one to use.3031## Wireless debugging32331. Prefer a project's maintained pairing helper when one exists. Otherwise use fresh endpoints shown by Android's Wireless debugging screen:3435 ```sh36 adb pair HOST:PAIR_PORT37 adb connect HOST:ADB_PORT38 ```39402. Treat the pairing port and normal ADB port as distinct. Enter the pairing code only at ADB's interactive prompt.413. Diagnose discovery with `adb mdns services`, `adb devices -l`, and `adb server-status`. Restart the local daemon only when its state is stale.424. If trust was removed on the device, pair again. Do not delete ADB keys or alter network security settings without explicit approval.4344## Build and install45461. Run the project's required tests and maintained debug or deployment build. Stop on any failed contract, test, or build.472. Identify artifacts and package IDs from build configuration or manifests; do not infer them solely from filenames.483. Prefer a maintained deployment command that verifies its work. Otherwise install a single APK with:4950 ```sh51 adb -s "$serial" install -r "$apk"52 ```53544. Use `install-multiple -r` for a validated split-APK set. An Android App Bundle is not directly installable; use the project's supported APK-generation path.555. Verify every expected package independently:5657 ```sh58 adb -s "$serial" shell pm path "$package_id"59 ```60616. Launch or configure the app only when requested. Report the target model, build/test result, artifact, install result, and package verification.6263## StarIntel Wear OS recipe6465When the checkout exposes the StarIntel Nix apps, build all modules and let the maintained installer deploy and verify the Wear app plus watch face:6667```sh68nix run .#build-all69nix run .#install-watch -- "$serial"70```7172The expected watch packages are `actor.starintel.wear` and `actor.starintel.watchface`. Never install the phone APK on a watch.7374## Rules7576- Never hard-code a serial, private address, port, pairing code, APK path, or package ID as a universal default.77- Prefer an exact online serial from `adb devices` over a stale remembered endpoint.78- Preserve user data with `-r` unless the user explicitly requests a clean reinstall.79- After source updates or a request to deploy "again," rebuild before installing.80- Do not report success from pairing, an open TCP port, or `adb install` alone; verify the expected packages.