Alternative solution - ADB over Network
An alternative solution exists for remotely accessing Android devices but it is more limited than FlexiHub. This method, called ADB over network or TCP/IP debugging can only connect over a LAN. It can be used to establish wireless connections to a rooted Android device without a USB cable. A cable will be needed to change the debugging mode on non-rooted devices. This technique simplifies sharing an Android device with a group of developers.
Steps for remote Android debugging with ADB over network method
This method requires that the Android device is rooted. If it is not, you will need to root the device before proceeding. The following steps are necessary to debug remote Android with ADB over the network.
If the device is not rooted, you will need:
- A computer with the Android SDK installed;
- A USB cable;
- The Android device that will be recognized as an ADB device.
Now follow these steps:
- Connect the Android device to the computer using a USB cable.
- Open a terminal, for example, by executing cmd.exe.
- Access the platform-tools folder of your Android SDK with this command:
- Execute this command
“Adb tcpip 5555” replacing 5555 with the port that will be used to listen for incoming connections.
If the device is rooted, you need one of these items:
- A terminal emulator application installed on your Android device;
- An application that allows you to access TCP/IP debugging mode for ADB over network;
- A menu setting to enable TCP/IP debugging mode. This may be available in the ROM in the "Developer settings" menu. It might be called ADB over network.
Now, enable TCP/IP debugging mode on the rooted Android device with the following steps.
- Enable TCP/IP debugging mode or ADB over network in the device’s "Developer settings".
- Run the following commands in a terminal emulator:
setprop service.adb.tcp.port 5555 changing 5555 the port you will use.
- Use an application that enables TCP/IP debugging.
Connecting to the remote Android device requires you to know the IP address of the device. Use one of these methods to obtain the device’s IP address:
- Check your device settings which are typically found in Settings > Wi-Fi > Advanced Wi-Fi.
This may be different based on your OS and device manufacturer.
- Look for the IP address of your device on your network router’s settings page.
- Run the adb shell netcfg in the "platform-tools" directory of your Android SDK installation
Establishing a connection to the Android device
- Run the following comment from the development machine in the "platform-tools" directory of your Android SDK installation: adb connect :. Use the IP address located previously and the port you will use for the connection.
- A successful connection with result in the command window displaying connected to :. The connected Android device will be visible in the Projects Window. The adb devices command lists all connected ADB devices.
Disconnecting from a remote Android device
To disconnect from the Android device, run the adb disconnect : command on the development machine.
You can also opt to reset the debugging mode on the device. Debugging mode is reset when you restart the device. You can reset debugging mode without a restart with the following procedure.
- Run the adb usb command on the remote machine connected to the Android device with a USB cable.
- Run the following commands in a terminal emulator on the device:
setprop service.adb.tcp.port -1