Skip to content
DeveloperMemos

Disconnecting a Device with ADB

Android, ADB, Device1 min read

When working on Android development projects, it's common to connect physical or virtual devices to your computer for testing and debugging purposes. The Android Debug Bridge (ADB) is a versatile command-line tool that allows you to interact with these connected devices. In this article, we'll focus on disconnecting a device using ADB.

Prerequisites

Before proceeding, ensure that you have the following prerequisites in place:

  1. Android SDK installed on your development machine.
  2. ADB command-line tool available in your system path.

Identifying Connected Devices

To disconnect a device, we first need to identify the unique identifier associated with it. Follow these steps:

  1. Open a terminal or command prompt.
  2. Run the following command to list the connected devices:
1adb devices

This command will display a list of connected devices along with their unique identifiers, known as device IDs.

Example output:

1List of devices attached
2emulator-5554 device
398819239 device

In the example above, two devices are listed: "emulator-5554" and "98819239". Note down the device ID of the device you want to disconnect.

Disconnecting a Device

Once you have identified the device ID, you can use the adb disconnect command to disconnect it. Replace <device-id> with the actual device ID you obtained in the previous step.

1adb disconnect <device-id>

Example:

1adb disconnect emulator-5554

This command will disconnect the specified device from your development environment.

Verifying Disconnection

To verify that the device has been successfully disconnected, you can run the adb devices command again. If the device is no longer connected, it won't be listed in the output. By following the steps outlined, you can easily disconnect a connected Android device from your development environment.