2016-08-06

You know what, interacting with the emulated Android device is one of the most important skills for both a developer & test automation engineer. For that we need some bridge to communicate or manage

Here comes Android Debug Bridge (ADB). When your phone is connected, and USB debugging is enabled, you can pass commands and communicate with the phone using your computer screen and keyboard using this ADB. This not only works for real devices but also virtual devices. You don’t believe me? Okay let’s try something with ADB.

First check whether ADB has been installed or not by using the command:

adb devices. If not, then type following command:

sudo apt-get install android-tools-adb android-tools-fastboot

To interact with a virtual device using the ADB try the below steps

1. You’ll need to start an AVD first or, if you like, simply plug in your own Android device via a USB to whatever machine you’d like to use. Don’t forget to on Debugging mode in your real device. You can start the AVD as shown in the previous article or using the following command in Terminal:

’emulator –avd [name]’



2. We can list all the connected Android Devices by using the following command for a
Windows OS:

C;\\[path-to-sdk-install]\platform-tools\adb devices
Linux OS:

pathofSDK/platform-tools/adb devices



This command should give you a list of the connected devices, which is basically all

the devices that you will be able to connect to using ADB. In above image, you can notice that, I was connected to some IP address. I have done this using the command:  ‘adb connect IP address’

3. You can launch a shell connection to your Android device using the following command:

/sdk/platform-tools/abd shell –s [specific device]

If this works well, you should see a prompt string—the string displayed to identify the

command shell being used—similar to the following command:
root@android$



This says you were impersonated to the device. Now you can view the files present in the device using basic CLI commands

This is so simple right! Next we will see few basic ADB commands. ADB is really helpful while debugging.

Filed under: APPIUM Tagged: ANDROID, APPIUM

Show more