-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added documentation for connecting device using adb wirelessly
- Loading branch information
1 parent
9caa6b8
commit c7e6611
Showing
1 changed file
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# Connecting real device using adb wirelessly | ||
|
||
## Introduction | ||
|
||
Connecting Android Debug Bridge (ADB) wirelessly to your device can be convenient, especially when working with devices that don't have easily accessible USB ports or when you want to avoid cable clutter. This guide will walk you through the process of connecting ADB to your Android device wirelessly using the Command Line Interface (CLI). | ||
|
||
## Prerequisites | ||
|
||
- Android device (Android-11 or above) | ||
- [Developer Options](https://developer.android.com/studio/debug/dev-options) enabled on your device. | ||
- Install Android SDK using [mobile-helper-tool](https://github.com/nightwatchjs/mobile-helper-tool): `npx @nightwatch/mobile-helper android`. | ||
|
||
### Android Debug Bridge (adb) | ||
|
||
The whole process is done using `adb` command line tool. So, you would need to make sure that `adb` is available from your terminal. You can check this by running `adb --version`. | ||
|
||
If `adb` is not available directly, you can either add its location to your `PATH` environment variable, or `cd` to the location where the `adb` binary is present and use it directly from there. | ||
|
||
The `adb` binary will be present in the `platform-tools` sub-directory of your Android SDK setup location. | ||
|
||
### Adding `adb` location to `PATH` | ||
|
||
Add the path of `platform-tools` directory to your `PATH` environment variable. | ||
|
||
**Linux/Mac**: | ||
|
||
Add the below command at the end of your `~/.bashrc` or `~./bash_profile` file and restart the terminal. | ||
|
||
```bash | ||
export PATH=$PATH:/path/to/Android/sdk/platform-tools/ | ||
``` | ||
|
||
**Windows**: | ||
|
||
Add the below path to your `PATH` environment variable in the Control Panel and restart the terminal. | ||
|
||
```bash | ||
\path\to\Android\sdk\platform-tools\ | ||
``` | ||
|
||
### Using `adb` directly | ||
|
||
To use `adb` directly (without adding it to `PATH`), simply go to the directly where the binary is present and use it as follows: | ||
|
||
```bash | ||
cd /path/to/Android/sdk/platform-tools/ | ||
|
||
# for windows | ||
adb.exe --version | ||
|
||
# for mac/linux | ||
./adb --version | ||
``` | ||
|
||
## Steps | ||
|
||
### Enable Wireless Debugging on your device | ||
|
||
1. Connect your device to the same network as your computer. You may connect the device to your computer's hotspot. | ||
2. Enable wireless debugging on your device by going to: `settings > wireless debugging`. | ||
|
||
### Pair your device with your comptuer | ||
|
||
```bash | ||
adb pair <ip_address>:<pairing_port> <pairing_code> | ||
``` | ||
|
||
Find your device's IP address, pairing port and pairing code by going to: `settings > wireless debugging > pair device with pairing code`. | ||
|
||
> The pairing port is different from actual port of your device. However, IP address remains same. | ||
### Connect your device with your computer | ||
|
||
```bash | ||
adb connect <ip_address>:<port> | ||
``` | ||
|
||
Find your device's IP address and port number by going to: `settings > wireless debugging`. | ||
|
||
You can see your connected device by running the following command. | ||
|
||
```bash | ||
adb devices | ||
``` | ||
|
||
```bash | ||
#output of adb devices | ||
List of devices attached | ||
10.42.0.88:38233 device | ||
``` | ||
Here `10.42.0.88:38233` is the device id which combines the IP address and port number of the connected device. | ||
|
||
### Disconnecting your device | ||
|
||
To disconnect your device, simply run the below command. | ||
|
||
```bash | ||
adb disconnect <device_id> | ||
``` | ||
|
||
To disconnect all the connected devices. | ||
|
||
```bash | ||
adb kill-server | ||
``` |