Android Debug Bridge (adb) _ Android Studio _ Android Developers
Android Debug Bridge (adb) _ Android Studio _ Android Developers
com/tools/adb
Android Debug Bridge ( ) is a versatile command-line tool that lets you communicate with
a device. The command facilitates a variety of device actions, such as installing and
debugging apps. provides access to a Unix shell that you can use to run a variety of
commands on a 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 command-line terminal by issuing an command.
• A server, which manages communication between the client and the daemon. The
server runs as a background process on your development machine.
is included in the Android SDK Pla�orm Tools package. Download this package with the
SDK Manager (/studio/intro/update#sdk-manager), which installs it at
. If you want the standalone Android SDK Pla�orm Tools package, download it here
(/studio/releases/pla�orm-tools).
For information on connecting a device for use over , including how to use the
Connection Assistant to troubleshoot common problems, see Run apps on a hardware
device (/studio/run/device).
When you sta� an client, the client �rst checks whether there is an server process
already running. If there isn't, it sta�s the server process. When the server sta�s, it binds to
local TCP po� 5037 and listens for commands sent from clients.
Note: All clients use po� 5037 to communicate with the server.
The server then sets up connections to all running devices. It locates emulators by scanning
odd-numbered po�s in the range 5555 to 5585, which is the range used by the �rst 16
1 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
emulators. Where the server �nds an daemon (adbd), it sets up a connection to that
po�.
Each emulator uses a pair of sequential po�s — an even-numbered po� for console
connections and an odd-numbered po� for connections. For example:
As shown, the emulator connected to on po� 5555 is the same as the emulator whose
console listens on po� 5554.
Once the server has set up connections to all devices, you can use commands to
access those devices. Because the server manages connections to devices and handles
commands from multiple clients, you can control any device from any client or from a
script.
To use adb with a device connected over USB, you must enable USB debugging in the
device system se�ings, under Developer options. On Android 4.2 (API level 17) and higher,
the Developer options screen is hidden by default. To make it visible, enable Developer
options. (/studio/debug/dev-options#enable)
You can now connect your device with USB. You can verify that your device is connected by
executing from the directory. If connected,
you'll see the device name listed as a "device."
Note: When you connect a device running Android 4.2.2 (API level 17) or higher, the system shows a
dialog asking whether to accept an RSA key that allows debugging through this computer. This security
mechanism protects user devices because it ensures that USB debugging and other adb commands
cannot be executed unless you're able to unlock the device and acknowledge the dialog.
2 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
For more information about connecting to a device over USB, read Run apps on a hardware
device (/studio/run/device).
Note: The instructions below do not apply to Wear devices running Android 11 (API level 30). See the
guide to debugging a Wear OS app (/training/wearables/get-sta�ed/debugging#wi�-debugging) for more
information.
Android 11 (API level 30) and higher suppo� deploying and debugging your app wirelessly
from your workstation using Android Debug Bridge (adb). For example, you can deploy your
debuggable app to multiple remote devices without ever needing to physically connect your
device via USB. This eliminates the need to deal with common USB connection issues, such
as driver installation.
• Ensure that your workstation and device are connected to the same wireless network.
• Ensure that your device is running Android 11 (API level 30) or higher for phone or
Android 13 (API level 33) or higher for TV and WearOS. For more information, see Check
& update your Android version (h�ps://suppo�.google.com/android/answer/7680439).
• If using the IDE, ensure that you have the latest version of Android Studio installed. You
can download it here (/studio).
• On your workstation, update to the latest version of the SDK Pla�orm Tools
(/studio/releases/pla�orm-tools).
To use wireless debugging, you must pair your device to your workstation using a QR code
or a pairing code. Your workstation and device must be connected to the same wireless
network. To connect to your device, follow these steps:
���Open Android Studio and select Pair Devices Using Wi-Fi from the run con�gurations
menu.
3 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
The Pair devices over Wi-Fi window pops up, as shown in �gure 2.
4 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
���On your device, tap Wireless debugging and pair your device:
a��To pair your device with a QR code, select Pair device with QR code and scan
5 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
the QR code obtained from the Pair devices over Wi-Fi popup shown in �gure 2.
b��To pair your device with a pairing code, select Pair device with pairing code
from the Pair devices over Wi-Fi popup. On your device, select Pair using
pairing code and take note of the six-digit code provided. Once your device
appears on the Pair devices over Wi-Fi window, you can select Pair and enter
the six-digit code shown on your device.
���A�er your device is paired, you can a�empt to deploy your app to your device.
To pair a di�erent device or to forget the current device on your workstation, navigate
to Wireless debugging on your device. Tap your workstation name under Paired
devices and select Forget.
���If you want to quickly turn on and o� wireless debugging, you can utilize the Quick
se�ings developer tiles (/studio/debug/dev-options#general) for Wireless debugging,
found in Developer Options > Quick se�ings developer tiles.
6 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
Figure 5. The Quick se�ings developer tiles se�ing lets you quickly turn wireless
debugging on and o�.
Alternatively, to connect to your device using command line without Android Studio, follow
these steps:
���Find your IP address, po� number, and pairing code by selecting Pair device with
pairing code. Take note of the IP address, po� number, and pairing code displayed on
the device.
7 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
Figure 6. A message indicates that your device has been successfully paired.
If you are having issues connecting to your device wirelessly, try the following
troubleshooting steps to resolve the issue.
Check that the workstation and device meet the prerequisites listed at the beginning of this
section (#connect-to-a-device-over-wi-�-android-11+).
The following is a list of current known issues with wireless debugging (with adb or Android
Studio) and how to resolve them:
• Wi-Fi is not connecting: Secure Wi-Fi networks, such as corporate Wi-Fi networks,
may block p2p connections and not let you connect over Wi-Fi. Try connecting with a
cable or another (non-corp) Wi-Fi network. Wireless connection using
over tcp/ip (following an initial USB connection) is another option, in case
reso�ing to a non-corp network is an option.
• over Wi-Fi sometimes turns o� automatically: This can happen if the device
either switches Wi-Fi networks or disconnects from the network. To resolve, re-
connect to the network.
8 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
Note: This work�ow is applicable also to Android 11 (and higher), the caveat being that it also involves an
*initial* connection over physical USB.
Note: The following instructions do not apply to Wear devices running Android 10 (API level 29) or lower.
See the guide about debugging a Wear OS app
(/training/wearables/get-sta�ed/debugging#wi�-debugging) for more information.
usually communicates with the device over USB, but you can also use over Wi-Fi. To
connect a device running Android 10 (API level 29) or lower, follow these initial steps over
USB:
���Connect your Android device and host computer to a common Wi-Fi network.
Note: Beware that not all access points are suitable. You might need to use an access point whose
�rewall is con�gured properly to suppo� .
���Set the target device to listen for a TCP/IP connection on po� 5555:
���Find the IP address of the Android device. For example, on a Nexus device, you can
�nd the IP address at Se�ings > About tablet (or About phone) > Status > IP
9 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
address.
$ adb devices
List of devices attached
:5555 device
• Make sure that your host is still connected to the same Wi-Fi network as your Android
device.
adb kill-server
Before issuing commands, it is helpful to know what device instances are connected to
the server. Generate a list of a�ached devices using the command:
10 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
adb devices -l
• Serial number: creates a string to uniquely identify the device by its po� number.
Here's an example serial number:
• State: The connection state of the device can be one of the following:
• : The device is connected to the server. Note that this state does not
imply that the Android system is fully booted and operational, because the device
connects to while the system is still booting. A�er boot-up, this is the normal
operational state of a device.
• Description: If you include the option, the command tells you what the
device is. This information is helpful when you have multiple devices connected so that
you can tell them apa�.
The following example shows the command and its output. There are three devices
running. The �rst two lines in the list are emulators, and the third line is a hardware device
that is a�ached to the computer.
$ adb devices
List of devices attached
emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 d
emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:
0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo
11 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
on your desktop. This happens when all of the following conditions are true:
• The odd-numbered po� you chose is not busy, so the po� connection can be made at
the speci�ed po� number — or, if it is busy, the emulator switches to another po� that
meets the requirements in 2.
One way to avoid this situation is to let the emulator choose its own po�s and to run no
more than 16 emulators at once. Another way is to always sta� the server before you
use the command, as explained in the following examples.
Stop the server and enter the following commands in the order shown. For the AVD
name, provide a valid AVD name from your system. To get a list of AVD names, type
. The command is in the directory.
$ adb kill-server
$ emulator -avd Nexus_6_API_25 -port 5555
$ adb devices
To see the emulator in the output, stop the server, and then sta� it again
a�er using the command and before using the command, as follows:
12 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
$ adb kill-server
$ emulator -avd Nexus_6_API_25 -port 5557
$ adb start-server
$ adb devices
For more information about emulator command-line options, see Command-Line sta�up
options (/studio/run/emulator-commandline#sta�up-options).
If multiple devices are running, you must specify the target device when you issue the
command. To specify the target, follow these steps:
���Once you have the serial number, use the option with the commands to specify
the serial number.
a��If you're going to issue a lot of commands, you can set the
environment variable to contain the serial number instead.
In the following example, the list of a�ached devices is obtained, and then the serial number
of one of the devices is used to install the on that device:
$ adb devices
List of devices attached
emulator-5554 device
emulator-5555 device
0.0.0.0:6520 device
# To install on emulator-5555
$ adb -s emulator-5555 install helloWorld.apk
13 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
# To install on 0.0.0.0:6520
$ adb -s 0.0.0.0:6520 install helloWorld.apk
Note: If you issue a command without specifying a target device when multiple devices are available,
displays an error "adb: more than one device/emulator".
If you have multiple devices available but only one is an emulator, use the option to send
commands to the emulator. If there are multiple devices but only one hardware device
a�ached, use the option to send commands to the hardware device.
You can use to install an APK on an emulator or connected device with the
command:
adb install
You must use the option with the command when you install a test APK. For
more information, see (#-t-option).
To install multiple APKs use . This is useful if you download all the APKs
for a speci�c device for your app from the Play Console and want to install them on an
emulator or physical device.
For more information about how to create an APK �le that you can install on an emulator/
device instance, see Build and run your app (/studio/run).
Note: If you are using Android Studio, you do not need to use directly to install your app on the
emulator or device. Instead, Android Studio handles the packaging and installation of the app for you.
14 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
Use the command to set up arbitrary po� forwarding, which forwards requests on
a speci�c host po� to a di�erent po� on a device. The following example sets up forwarding
of host po� 6100 to device po� 7100:
This could be useful if you are trying to detemine what is being sent to a given po� on the
device. All received data will be wri�en to the system-logging daemon and displayed in the
device logs.
Use the and commands to copy �les to and from a device. Unlike the
command, which only copies an APK �le to a speci�c location, the and
commands let you copy arbitrary directories and �les to any location in a device.
To copy a �le or directory and its sub-directories from the device, do the following:
adb pull
To copy a �le or directory and its sub-directories to the device, do the following:
15 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
adb push
Replace and with the paths to the target �les/directory on your development
machine (local) and on the device (remote). For example:
In some cases, you might need to terminate the server process and then resta� it to
resolve the problem. For example, this could be the case if does not respond to a
command.
To stop the server, use the command. You can then resta� the server
by issuing any other command.
Issue commands from a command line on your development machine or from a script
using the following:
adb [-d | -e | -s ]
If there's only one emulator running or only one device connected, the command is sent
to that device by default. If multiple emulators are running and/or multiple devices are
a�ached, you need to use the , , or option to specify the target device to which the
command should be directed.
You can see a detailed list of all suppo�ed commands using the following command:
16 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
adb --help
You can use the command to issue device commands through or to sta� an
interactive shell. To issue a single command, use the command like this:
Android provides most of the usual Unix command-line tools. For a list of available tools, use
the following command:
Help is available for most of the commands via the argument. Many of the shell
commands are provided by toybox (h�p://landley.net/toybox/). General help applicable to all
toybox commands is available via .
With Android Pla�orm Tools 23 and higher, handles arguments the same way that the
command does. This change has �xed a lot of problems with command injection
(h�ps://en.wikipedia.org/wiki/Code_injection#Shell_injection) and makes it possible to safely
17 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
Within an shell, you can issue commands with the activity manager ( ) tool to pe�orm
various system actions, such as sta� an activity, force-stop a process, broadcast an intent,
modify the device screen prope�ies, and more.
am
You can also issue an activity manager command directly from without entering a
remote shell. For example:
Command Description
18 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
Options are:
• : Enable debugging.
Options are:
Options are:
• : Specify which
user's processes to kill. If not speci�ed, then kill all users'
19 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
processes.
Options are:
• : Specify which
user to send to. If not speci�ed, then send to all users.
Options are:
Stop pro�ler on .
20 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
Options are:
• : When supplying a
process name, specify the user of the process to dump. If
not speci�ed, the current user is used.
Options are:
21 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
For activity manager commands that take an argument, you can specify the intent
with the following options:
Show all
Specify the intent MIME type, such as . You can declare this only once.
Specify the component name with package name pre�x to create an explicit intent,
such as .
22 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
Add a null extra. This option is not suppo�ed for URI intents.
23 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
24 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
25 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
Requires the use of and options to set the intent data and type.
You can directly specify a URI, package name, and component name when not
quali�ed by one of the preceding options. When an argument is unquali�ed, the tool
assumes the argument is a URI if it contains a ":" (colon). The tools assumes the
argument is a component name if it contains a "/" (forward-slash); otherwise it
assumes the argument is a package name.
Within an shell, you can issue commands with the package manager ( ) tool to
pe�orm actions and queries on app packages installed on the device.
26 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
pm
You can also issue a package manager command directly from without entering a
remote shell. For example:
Command Description
Options:
27 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
Options:
• : Organize by group.
• : Sho� summary.
Options:
28 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
(/studio/command-line/adb#-t-option) with
the command if you are installing
a test APK.
• : Specify
the installer package name.
• : Set the
install location using one of the following
values:
prevents from
using this feature.
29 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
• : Only
uninstalls if the app has the given version
code.
Options:
30 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
31 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
domain
• : rejected by a legacy
veri�er, unknown reason
• : automatically
approved by the device con�g
Options are:
Options are:
32 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
• : reset as
if no response was ever recorded.
• : treat domain
as successfully veri�ed by domain
veri�cation agent. Note that the
domain veri�cation agent can
override this.
• : treat domain
as always approved, preventing the
domain veri�cation agent from
changing it.
• : treat domain as
always denied, preventing the domain
veri�cation agent from changing it.
33 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
34 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
To help you develop and test your device management apps, issue commands to the device
policy manager ( ) tool. Use the tool to control the active admin app or change a policy's
status data on the device.
dpm
You can also issue a device policy manager command directly from without entering a
remote shell:
Command Description
Options are:
Options are:
35 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
Options are:
Options are:
Clear the device's record of previously set freeze periods for syste
updates. This is useful to avoid the device scheduling restrictions
developing apps that manage freeze periods. See Manage system
updates (/work/dpc/system-updates#development_and_testing
Suppo�ed on devices running Android 9.0 (API level 28) and highe
Force the system to make any existing network logs ready for retri
a DPC. If there are connection or DNS logs available, the DPC rece
the
(/reference/android/app/admin/
DeviceAdminReceiver#onNetworkLogsAvailable(android.content.C
%20android.content.Intent,%20long,%20int))
callback. See Network activity logging
(/work/dpc/logging#development_and_testing).
(/reference/android/app/admin/
DeviceAdminReceiver#onSecurityLogsAvailable(android.content.C
%20android.content.Intent))
callback. See Log enterprise device activity
36 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
(/work/dpc/security#log_enterprise_device_activity).
screencap
Here's an example screenshot session, using the shell to capture the screenshot and
the command to download the �le from the device:
$ adb shell
shell@ $ screencap ∕sdcard∕screen.png
shell@ $ exit
$ adb pull ∕sdcard∕screen.png
The command is a shell utility for recording the display of devices running
Android 4.4 (API level 19) and higher. The utility records screen activity to an MPEG-4 �le.
You can use this �le to create promotional or training videos or for debugging and testing.
37 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
screenrecord [ ]
Stop the screen recording by pressing Control+C. Otherwise, the recording stops
automatically at three minutes or the time limit set by .
To begin recording your device screen, run the command to record the video.
Then, run the command to download the video from the device to the host computer.
Here's an example recording session:
$ adb shell
shell@ $ screenrecord --verbose ∕sdcard∕demo.mp4
(press Control + C to stop)
shell@ $ exit
$ adb pull ∕sdcard∕demo.mp4
The utility can record at any suppo�ed resolution and bit rate you request,
while retaining the aspect ratio of the device display. The utility records at the native display
resolution and orientation by default, with a maximum length of three minutes.
• Some devices might not be able to record at their native display resolution. If you
38 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
encounter problems with screen recording, try using a lower screen resolution.
• Rotation of the screen during recording is not suppo�ed. If the screen does rotate
during recording, some of the screen is cut o� in the recording.
Table 4. options
Options Description
Set the video size: . The default value is the device's native display
resolution (if suppo�ed), 1280x720 if not. For best results, use a size suppo�ed
by your device's Advanced Video Coding (AVC) encoder.
Set the video bit rate for the video, in megabits per second. The default value is
20Mbps. You can increase the bit rate to improve video quality, but doing so
results in larger movie �les. The following example sets the recording bit rate to
6Mbps:
screenrecord --bit-rate 6000000 ∕sdcard∕demo.mp4
Set the maximum recording time, in seconds. The default and maximum value is
180 (3 minutes).
Display log information on the command-line screen. If you do not set this
option, the utility does not display any information while running.
Sta�ing in Android 7.0 (API level 24), the Android Runtime (ART) collects execution pro�les
for installed apps, which are used to optimize app pe�ormance. Examine the collected
pro�les to understand which methods are executed frequently and which classes are used
during app sta�up.
Note: It is only possible to retrieve the execution pro�le �lename if you have root access to the �le
39 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
To produce a text form of the pro�le information, use the following command:
If you test your app across multiple test devices, it may be useful to reset your device
between tests, for example, to remove user data and reset the test environment. You can
pe�orm a factory reset of a test device running Android 10 (API level 29) or higher using the
shell command, as shown:
When restoring the device using , the device automatically backs up the RSA
key that allows debugging through the current workstation in a persistent location. That is,
a�er the device is reset, the workstation can continue to debug and issue commands to
the device without manually registering a new key.
Additionally, to help make it easier and more secure to keep testing your app, using the
to restore a device also changes the following device se�ings:
• The device sets up ce�ain system se�ings so that initial device setup wizards do not
appear. That is, the device enters a state from which you can quickly install, debug, and
test your app.
40 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
• Se�ings:
• Other:
If your app needs to detect and adapt to the default se�ings of the command,
use the
(/reference/android/app/ActivityManager#isRunningInUserTestHarness()).
Note: It is only possible to access a SQLite database if you have root access to the �le system, for
example, on an emulator.
41 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
The adb server can interact with the USB stack through two backends. It can either use the
native backend of the OS (Windows, Linux, or macOS) or it can use the backend.
Some features, such as , , and USB speed detection, are only available when
using backend.
You can choose a backend by using the environment variable. If it isn't set, adb
uses its default backend. The default behavior varies among OS. Sta�ing with ADB v34
(h�ps://developer.android.com/tools/releases/pla�orm-tools#revisions), the backend is
used by default on all OS except Windows, where the native backend is used by default. If
is set, it determines whether the native backend or is used. See the adb
manual page
(h�ps://android.googlesource.com/pla�orm/packages/modules/adb/+/refs/heads/master/docs/user/
adb.1.md)
for more information about adb environment variables.
Experimental: Suppo� for using the backend with Windows is experimental. As of ADB v34, only
the macOS and Linux pla�orms have been tested with the library.
ADB can use the multicast DNS protocol to automatically connect the server and devices.
The ADB server ships with two backends, Bonjour (Apple's mdnsResponder) and
Openscreen.
The Bonjour backend needs a daemon to be running on the host machine. On macOS
Apple's built-in daemon is always running, but on Windows and Linux, the user must make
sure the daemon is up and running. If the command returns an error,
it is likely that ADB is using the Bonjour backend but there is no Bonjour daemon running.
The Openscreen backend does not need a daemon to be running on the machine. Suppo�
for the Openscreen backend on macOS sta�s at ADB v35. Windows and Linux are
suppo�ed as of ADB v34.
By default ADB uses the Bonjour backend. This behavior can be changed using the
42 of 43 8/14/24, 23:48
Android Debug Bridge (adb) | Android Studio | Andro... https://developer.android.com/tools/adb
Content and code samples on this page are subject to the licenses described in the Content License (/license).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its a�liates.
43 of 43 8/14/24, 23:48