The adb connect
command is used to connect to a device or emulator over the network using ADB (Android Debug Bridge). This can be useful when the device is not connected to your computer via USB but is on the same network.
Here’s how you can use the adb connect
command:
Open a command prompt or terminal on your computer.
Navigate to the directory where the ADB executable is located. This is often in the “platform-tools” directory within the Android SDK installation.
$ cd path/to/android-sdk/platform-tools
Connect the Android device to the same network as your computer.
Find the IP address of the Android device. You can usually find this information in the device’s settings or by running the following command on the device:
$ adb shell ip -f inet addr show wlan0
Replace wlan0
with the appropriate interface if necessary.
Run the following command on your computer, replacing <device_ip>
with the actual IP address of your Android device:
$ adb connect <device_ip>
For example:
$ adb connect 192.168.0.100
If the connection is successful, you’ll see a message indicating that the connection has been established.
After connecting over the network, you can use ADB commands as if the device were connected via USB. For example:
$ adb shell
This allows you to execute commands on the Android device over the network. Remember that both your computer and the Android device need to be on the same network for this to work.