In developing applications on the Android platform, there are two alternatives for testing apps: using an emulator or using a real device. The emulators are quite slow, so normally you tend to use a device, which is normally connected to the PC via USB. This solution, however, has some contraindications: the overheating of the device (since it is always in charge), the deterioration of the USB connector and the need to use a cable.
The objective of this article is to explain how to install applications on an Android device via WiFi connection. As mentioned above, this can be very useful during development.
Some typical work scenarios will be presented and for each of them, the steps necessary to activate the wireless connection will be illustrated. In particular, we will see how to do it on both Eclipse and Android Studio, and for both these IDEs, we will see how to handle the situation in case you have a device with and without root permissions.
For those who do not know, obtaining root permissions on a device means to authenticate to it system with the system of higher privileges, so as to bypass the restrictions to which a user account must undergo and freely modify even the settings that are normally inaccessible. It is important to underline how this measure exposes Android to many security risks; however, especially on smartphones and tablets, these privileges are essential if you want to use some software or unlock certain functions.
Prerequisites
The following article assumes that the reader already has a minimal development experience on Android, which has already installed the Android SDK on the PC and knows how to install on an application device starting from Eclipse or Android Studio. Each of this information can be found by referring to the Android app development guide, published on HTML.it.
In the case of Eclipse, we consider the latter already integrated with the Android Development Tools ( ADT ) plugin.
To test the connection techniques of these articles, a WiFi network is needed to connect the PC and the Android device.
The operating system used is Windows 7. Except for the obvious differences, what will be said also applies to Linux and OSX.
Before proceeding, it is good to remember that, in order to install applications on an Android device via USB (which could be useful in the following of this tutorial), it is necessary to enable the relevant option from the developer menu, as shown in the following figure.
Android Debug Bridge
Communication between the PC and the Android device is via the Android Debug Bridge or ADB, a utility that is installed together with the Android SDK. It is usually installed in the <android-sdk-home> / platform-tools subfolder. It is advisable to insert this path between the default paths, as shown in the following sequence of images.
Assuming that you have already defined an ANDROID_SDK environment variable corresponding to the Android SDK path, just enter the string % ANDROID_SDK% / platform-tools in the PATH variable declaration.
If everything is configured as expected, open the command prompt and type the following:
<pre class=”brush: php; html-script: true”>
>Adb version
</pre>
we will get an output similar to the following:
<pre class=”brush: php; html-script: true”>
Android Debug Bridge version 1.0.xx
</pre>
Android device configuration
The configuration of the Android device is independent of the development environment used on the PC side. The discriminant, in this case, is the presence or absence of root permissions on the device.
Configuring devices with root permissions
For devices with root permissions, we need to install an app that allows you to use ADB over WiFi. On the Google Play Store, there are several possibilities, among which we highlight ADB over Wifi Widget.
This app allows you to install a widget on your device which, if activated, shows an icon with the IP address and port used. This data will be useful for interfacing via WiFi.

A device without root permissions
On devices without root permissions, it is not possible to use programs that enable ADB over WiFi. You can still install some applications that allow you to easily view the IP address of the Android device once it is connected to the WiFi network. Among those available, we report Show My IP.

WiFi connection with Eclipse
In the last period, Google has promoted Android Studio as IDE of official development. Nonetheless, Eclipse has been the reference IDE for Android development for years and many still use it in the normal development of Android applications. It could not miss therefore a special section dedicated to the WiFi connection between PC and Android device through this IDE.
To be able to drive adb via WiFi from Eclipse, simply use the AdbConnect plugin, available on GitHub (where the simple installation instructions are listed). As we will see, this plugin allows you to connect your PC to an Android device via WiFi.
Once AdbConnect is installed, we will see its icon on the Eclipse toolbar.
To continue, you will need to activate the connection from the side of the Android device. If you use a device without root permissions you will need to follow the following steps:
- on the Android device, through the Show My IP app , we get the IP address assigned to the Android device;
- via USB connection, we connect (only for this time) the Android device to the PC;
- on the PC, using a command prompt, we execute the following command:
<pre class=”brush: php; html-script: true”>
adb tcpip 8000
</pre>
In the previous command, 8000 is the port you want to use for the connection. Running this command should produce a message like:
<pre class=”brush: php; html-script: true”>
restarting in TCP mode port: 8000
</pre>
- always on PC, using the command prompt, we execute the command below, where [IP-address-android] corresponds to the address of the Android device recovered in step 1:
<pre class=”brush: php; html-script: true”>
adb connect [indirizzo-IP-android]:8000
</pre>
- then disconnect the USB cable with which the device is connected;
- on Eclipse, in the special section of the plugin preferences, we set the IP address and the device port previously retrieved (see the figure below);
- finally, we activate the AdbConnect plugin through the appropriate icon. If the procedure has been carried out correctly, the icon will turn into the one shown in the following figure, and in the window will appear the log messages coming from the device.
If, however, the device has the root permissions it will be sufficient to execute the instructions of points 6 and 7 using the ADB over Wifi plugin described above.
These steps are only needed at the beginning of the application test session. Once the PC and the device are correctly “paired”, we will no longer need to perform this procedure.
WiFi connection in Android Studio
Android Studio houses a command console inside. Working with this development environment it is therefore not necessary to open a terminal separately, as it is possible to exploit the already integrated one.
Device with root permissions
To connect an Android device that enjoys root permissions to WiFi, with Android Studio, simply type the following statement in the command prompt, using the IP associated with the Android device you are using:
adb connect [address-IP-android]: 8000
Device without root permissions
If the device we are using does not have root permissions, we will have to execute the same instructions that must be performed with ADB when working with Eclipse:
- using a USB cable, connect the Android device to the PC;
- on PC, using a command prompt, we execute:
<pre class=”brush: php; html-script: true”>
adb tcpip 8000
</pre>
where 8000 is the port you want to use for the connection;
- always on the PC, we execute the following command:
<pre class=”brush: php; html-script: true”>
adb connect <indirizzo-IP-android>:8000
</pre>
- finally, disconnect the USB cable from the device, and we will finally be connected in WiFi.
Execution of the application on the device
After completing the steps necessary to connect the PC to the Android device via WiFi, regardless of the IDE used for development, the installation procedure of the application to be tested on the device remains almost unchanged compared to the way of operating via USB connection.
If you use Eclipse, simply select the item Run as -> Android Application from the context menu of the application you want to test
In the case of Android Studio, instead, you will have to select the project module to be executed and press the run button.
The first time you install, you will be asked to select the device on which to install the application, and in the list of those available will also be the one connected in WiFi.
Conclusions
We have seen how to use the adb utility to create a connection via a WiFi network between the PC used to develop and the Android device on which to perform the tests. On the PC side, we have seen how to configure it both if you use it as an Eclipse IDE, or if you use Android Studio. Android device side, we have seen how to configure the device with and without root permissions.
Adb proved to be a powerful and versatile tool, which is often ignored by Android developers because it is “hidden” by the IDE used. Anyone who wants to deepen the knowledge of this tool, can still consult the official documentation.