Scroll to navigation

ADB(1) adb Manuals ADB(1)

NAME

adb - Android Debug Bridge

SYNOPSIS

adb [-d|-e|-s serialNumber] command

DESCRIPTION

WARNING: This manual might be outdated, please refer to the official documentation.

Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program that includes three components:

A client, which sends commands. The client runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as DDMS also create adb clients.
A daemon, which runs commands on a device. The daemon runs as a background process on each emulator or device instance.
A server, which manages communication between the client and the daemon. The server runs as a background process on your development machine.

If there's only one emulator running or only one device connected, the 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 -d, -e, or -s option to specify the target device to which the command should be directed.

OPTIONS

Directs adb to listen on all interfaces for a connection.
Directs command to the only connected USB device. Returns an error if more than one USB device is present.
Directs command to the only running emulator. Returns an error if more than one emulator is running.
Directs command to the device or emulator with the given serial number or qualifier. Overrides ANDROID_SERIAL environment variable.
Simple product name like sooner, or a relative/absolute path to a product out directory like out/target/product/sooner. If -p is not specified, the ANDROID_PRODUCT_OUT environment variable is used, which must be an absolute path.
Name of adb server host (default: localhost)
Port of adb server (default: 5037)

COMMANDS

List all connected devices. -l will also list device qualifiers.
Connect to a device via TCP/IP. Port 5555 is used by default if no port number is specified.
Disconnect from a TCP/IP device. Port 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

Copy file/dir to device.
Copy file/dir from device. -a means copy timestamp and mode.
Copy host->device only if changed. -l means list but don't copy.

If directory is not specified, /system, /vendor (if present), /oem (if present) and /data partitions will be updated.

If it is system, vendor, oem or data, only the corresponding partition is updated.

Run remote shell command (interactive shell if no command given)
-e: Choose escape character, or none; default ~
-n: Don't read from stdin
-T: Disable PTY allocation
-t: Force PTY allocation
-x: Disable remote exit codes and stdout/stderr separation
Run emulator console command
View device log.
List all forward socket connections. The format is a list of lines with the following format: serial " " local " " remote ""
Forward socket connections.

Forward specs are one of:

tcp:port
localabstract:unix domain socket name
localreserved:unix domain socket name
localfilesystem:unix domain socket name
dev:character device name
jdwp:process pid (remote only)
Same as "adb forward local remote" but fails if local is already forwarded
Remove a specific forward socket connection.
Remove all forward socket connections.
List all reverse socket connections from device.
Reverse socket connections.

Reverse specs are one of:

tcp:port
localabstract:unix domain socket name
localreserved:unix domain socket name
localfilesystem:unix domain socket name
Same as 'adb reverse remote local' but fails if remote is already reversed.
Remove a specific reversed socket connection.
Remove all reversed socket connections from device.
List PIDs of processes hosting a JDWP transport.
Push this package file to the device and install it.
-l: Forward lock application.
-r: Replace existing application.
-t: Allow test packages.
-s: Install application on sdcard.
-d: Allow version code downgrade (debuggable packages only).
-g: Grant all runtime permissions.
Push this package file to the device and install it.
-l: Forward lock application.
-r: Replace existing application.
-t: Allow test packages.
-s: Install application on sdcard.
-d: Allow version code downgrade (debuggable packages only).
-p: Partial application install.
-g: Grant all runtime permissions.
Remove this app package from the device. -k means keep the data and cache directories.
Return all information from the device that should be included in a bug report.
Write an archive of the device's data to file. If no -f option is supplied then the data is written to backup.ab in the current directory.

-apk | -noapk enable/disable backup of the .apks themselves in the archive; the default is noapk.

-obb | -noobb enable/disable backup of any installed apk expansion (aka .obb) files associated with each application; the default is noobb.

-shared | -noshared enable/disable backup of the device's shared storage / SD card contents; the default is noshared.

-all means to back up all installed applications.

-system | -nosystem toggles whether -all automatically includes system applications; the default is to include system apps.

packages... is the list of applications to be backed up. If the -all or -shared flags are passed, then the package list is optional. Applications explicitly given on the command line will be included even if -nosystem would ordinarily cause them to be omitted.

Restore device contents from the file backup archive.
Disable dm-verity checking on USERDEBUG builds.
Re-enable dm-verity checking on USERDEBUG builds.
Generate adb public/private key. The private key is stored in file, and the public key is stored in file.pub. Any existing files are overwritten.
Show help message.
Show version number.

Scripting

Wait for device to be in the given state: device, recovery, sideload, or bootloader. transport is: usb, local or any (default = any)
Ensure that there is a server running.
Kill the server if it is running.
Prints: offline | bootloader | device
Prints: serial-number.
Prints: device-path.
Remounts the /system, /vendor (if present) and /oem (if present) partitions on the device read-write.
Reboots the device, optionally into the bootloader or recovery program.
Reboots the device into the sideload mode in recovery program (adb root required).
Reboots into the sideload mode, then reboots automatically after the sideload regardless of the result.
Sideloads the given package.
Restarts the adbd daemon with root permissions.
Restarts the adbd daemon without root permissions.
Restarts the adbd daemon listening on USB.
Restarts the adbd daemon listening on TCP on the specified port.

Networking

Run PPP over USB.

parameters: E.g. defaultroute debug dump local notty usepeerdns

Note: you should not automatically start a PPP connection. tty refers to the tty for PPP stream. E.g. dev:/dev/omap_csmi_tty1

Internal Debugging

Kick current connection from host side and make it reconnect.
Kick current connection from device side and make it reconnect.

ENVIRONMENT VARIABLES

Print debug information. A comma separated list of the following values 1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
The serial number to connect to. -s takes priority over this if given.
When used with the logcat option, only these debug tags are printed.

SEE ALSO

https://developer.android.com/tools/help/adb.html

AUTHORS

The Android Open Source Project.

android-platform-system-core