adb (1)
Leading comments
Automatically generated by Pandoc 1.17.2
NAME
adb - Android Debug Bridge
SYNOPSIS
B]adb] [-d|-e|-s I]serialNumber]] I]command]
DESCRIPTION
Android Debug Bridge (B]adb]) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device.
If there[aq]s only one emulator running or only one device connected, the B]adb] command is sent to that device by default. If multiple emulators are running and/or multiple devices are attached, you need to use the B]-d], B]-e], or B]-s] option to specify the target device to which the command should be directed.
OPTIONS
- -a
-
Directs B]adb] to listen on all interfaces for a connection.
- -d
-
Directs command to the only connected USB device.
Returns an error if more than one USB device is present.
- -e
-
Directs command to the only running emulator.
Returns an error if more than one emulator is running.
- -s I]specific device]
-
Directs command to the device or emulator with the given serial number
or qualifier.
Overrides B]ANDROID_SERIAL] environment variable.
- -p I]product name or path]
-
Simple product name like B]sooner], or a relative/absolute path to
a product out directory like B]out/target/product/sooner].
If B]-p] is not specified, the B]ANDROID_PRODUCT_OUT]
environment variable is used, which must be an absolute path.
- -H
-
Name of adb server host (default: B]localhost])
- -P
-
Port of adb server (default: B]5037])
COMMANDS
- adb devices [-l]
-
List all connected devices.
B]-l] will also list device qualifiers.
- adb connect I]host][:I]port]]
-
Connect to a device via TCP/IP.
Port B]5555] is used by default if no port number is specified.
- adb disconnect [I]host][:I]port]]]
-
Disconnect from a TCP/IP device.
Port B]5555] is used by default if no port number is specified.
Using this command with no additional arguments will disconnect from all
connected TCP/IP devices.
Device commands
- adb push [-p] I]local] I]remote]
-
Copy file/dir to device.
B]-p] to display the transfer progress.
- adb pull [-p] [-a] I]remote] [I]local]]
-
Copy file/dir from device.
B]-p] to display the transfer progress, B]-a] means copy
timestamp and mode.
- adb sync [I]directory]]
-
Copy host->device only if changed.
B]-l] means list but don[aq]t copy.
If I]directory] is not specified, B]/system], B]/vendor] (if present), B]/oem] (if present) and B]/data] partitions will be updated.
If it is B]system], B]vendor], B]oem] or B]data], only the corresponding partition is updated.
- adb shell
-
Run remote shell interactively.
- adb shell I]command]
-
Run remote shell command.
- adb emu I]command]
-
Run emulator console command
- adb logcat [I]filter-spec]]
-
View device log.
- adb forward --list
-
List all forward socket connections.
The format is a list of lines with the following format:
B]I]serial] " " I]local] " " I]remote] "\n"]
- adb forward I]local] I]remote]
-
Forward socket connections.
Forward specs are one of:
- [bu]
- tcp:I]port]
- [bu]
- localabstract:I]unix domain socket name]
- [bu]
- localreserved:I]unix domain socket name]
- [bu]
- localfilesystem:I]unix domain socket name]
- [bu]
- dev:I]character device name]
- [bu]
- jdwp:I]process pid] (remote only)
- adb forward --no-rebind I]local] I]remote]
-
Same as "adb forward I]local] I]remote]" but fails if
I]local] is already forwarded
- adb forward --remove I]local]
-
Remove a specific forward socket connection.
- adb forward --remove-all
-
Remove all forward socket connections.
- adb reverse --list
-
List all reverse socket connections from device.
- adb reverse I]remote] I]local]
-
Reverse socket connections.
Reverse specs are one of:
- [bu]
- tcp:I]port]
- [bu]
- localabstract:I]unix domain socket name]
- [bu]
- localreserved:I]unix domain socket name]
- [bu]
- localfilesystem:I]unix domain socket name]
- adb reverse --norebind I]remote] I]local]
-
Same as [aq]adb reverse I]remote] I]local][aq] but fails
if I]remote] is already reversed.
- adb reverse --remove I]remote]
-
Remove a specific reversed socket connection.
- adb reverse --remove-all
-
Remove all reversed socket connections from device.
- adb jdwp
-
List PIDs of processes hosting a JDWP transport.
- adb install [-lrtsdg] I]file]
-
Push this package file to the device and install it.
- [bu]
- B]-l]: Forward lock application.
- [bu]
- B]-r]: Replace existing application.
- [bu]
- B]-t]: Allow test packages.
- [bu]
- B]-s]: Install application on sdcard.
- [bu]
- B]-d]: Allow version code downgrade.
- [bu]
- B]-g]: Grant all runtime permissions.
- adb install-multiple [-lrtsdpg] I]file...]
-
Push this package file to the device and install it.
- [bu]
- B]-l]: Forward lock application.
- [bu]
- B]-r]: Replace existing application.
- [bu]
- B]-t]: Allow test packages.
- [bu]
- B]-s]: Install application on sdcard.
- [bu]
- B]-d]: Allow version code downgrade.
- [bu]
- B]-p]: Partial application install.
- [bu]
- B]-g]: Grant all runtime permissions.
- adb uninstall [-k] I]package]
-
Remove this app package from the device.
B]-k] means keep the data and cache directories.
- adb bugreport
-
Return all information from the device that should be included in a bug
report
- adb backup [-f I]file]] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] [I]packages...]]
-
Write an archive of the device[aq]s data to I]file].
If no B]-f] option is supplied then the data is written to
B]backup.ab] in the current directory.
B]-apk] | B]-noapk] enable/disable backup of the .apks themselves in the archive; the default is noapk.
B]-obb] | B]-noobb] enable/disable backup of any installed apk expansion (aka .obb) files associated with each application; the default is noobb.
B]-shared] | B]-noshared] enable/disable backup of the device[aq]s shared storage / SD card contents; the default is noshared.
B]-all] means to back up all installed applications.
B]-system] | B]-nosystem] toggles whether B]-all] automatically includes system applications; the default is to include system apps.
I]packages...] is the list of applications to be backed up. If the B]-all] or B]-shared] flags are passed, then the package list is optional. Applications explicitly given on the command line will be included even if B]-nosystem] would ordinarily cause them to be omitted.
- adb restore I]file]
-
Restore device contents from the I]file] backup archive.
- adb disable-verity
-
Disable dm-verity checking on USERDEBUG builds.
- adb enable-verity
-
Re-enable dm-verity checking on USERDEBUG builds.
- adb keygen I]file]
-
Generate adb public/private key.
The private key is stored in I]file], and the public key is stored
in I]file].pub.
Any existing files are overwritten.
- adb help
-
Show help message.
- adb version
-
Show version number.
Scripting
- adb wait-for-device
-
Block until device is online.
- adb start-server
-
Ensure that there is a server running.
- adb kill-server
-
Kill the server if it is running.
- adb get-state
-
Prints: B]offline] | B]bootloader] | B]device]
- adb get-serialno
-
Prints: I]serial-number].
- adb get-devpath
-
Prints: I]device-path].
- adb remount
-
Remounts the B]/system], B]/vendor] (if present) and
B]/oem] (if present) partitions on the device read-write.
- adb reboot [bootloader|recovery]
-
Reboots the device, optionally into the bootloader or recovery program.
- adb reboot sideload
-
Reboots the device into the sideload mode in recovery program (adb root
required).
- adb reboot sideload-auto-reboot
-
Reboots into the sideload mode, then reboots automatically after the
sideload regardless of the result.
- adb sideload I]file]
-
Sideloads the given package.
- adb root
-
Restarts the adbd daemon with root permissions.
- adb unroot
-
Restarts the adbd daemon without root permissions.
- adb usb
-
Restarts the adbd daemon listening on USB.
- adb tcpip I]port]
-
Restarts the adbd daemon listening on TCP on the specified port.
Networking
- adb ppp I]tty] [I]parameters]]
-
Run PPP over USB.
I]parameters]: Eg. B]defaultroute debug dump local notty usepeerdns]
Note: you should not automatically start a PPP connection. I]tty] refers to the tty for PPP stream. Eg. B]dev:/dev/omap_csmi_tty1]
ENVIRONMENT VARIABLES
- ADB_TRACE
-
Print debug information.
A comma separated list of the following values B]1] or
B]all], B]adb], B]sockets], B]packets],
B]rwx], B]usb], B]sync], B]sysdeps],
B]transport], B]jdwp]
- ANDROID_SERIAL
-
The serial number to connect to.
B]-s] takes priority over this if given.
- ANDROID_LOG_TAGS
-
When used with the logcat option, only these debug tags are printed.
SEE ALSO
developer.android.com/tools/help/adb.html