Reading Time: <5 minutes

What’s up Guys! Welcome to automationcalling.com

This blog is complete focus on ADB commands and trouble shooting.

Android Debug Bridge (adb)

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device. It is a client-server program that includes three components:

  • A client, which sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an adb command.
  • A daemon (adbd), which runs commands on a device. The daemon runs as a background process on each device.
  • A server, which manages communication between the client and the daemon. The server runs as a background process on your development machine.

How to verify device connected

=> adb devices (Will display list of devices connected to system)

adbDevices

Trouble Shooting:

In case device is not listed, the ADB Device interface needs to be updated. Go to Device Manager->Find ADB Device interface->Update driver

If Update Driver doesn’t automatically update from internet, open Android studio and select “Google USB Driver” and install

usbDriver

After installation, the driver get installed under %ANDROID-HOME%\extras/google/usb_driver

This time update ADB Device interface with downloaded file as followed in above screenshot.

Once again go to Device Manager->Find ADB Device interface->Update driver-> Select local drive option and select till usb_driver folder

localusb

Click on Next and Finish button.

This time device will be listed by supplying command adb devices.

If the adb connection ever lost

In case adb device doesn’t connect: use commands

  • adb kill-server
  • adb start-server
  • adb devices

Connect your devices via Wifi to your PC

  1. Plug the device1.
  2. To list the devices connected to PC “adb devices”.
  3. Set the target device to listen for a TCP/IP connection on port 5555  for eg., “adb tcpip 5555”.
  4. Unplug the device 1.
  5. Repeat step no.1 to step no.4 for multiple devices.
  6. Go to settings of your devices and find its IP addresses.
  7. Connect to the device by its IP address. “adb connect IPAddress:5555
  8. Now, list the devices. The following devices connected via Wifi
  9. wifidevices

How to find appPackage and appActivity name?

  1. Connect a device to PC
  2. Find the udid using command “adb devices”
  3. Run command “adb shell”
  4. adbshell
  5. Now, open your App before supply next command, for eg., I open calculator App
  6. dumpsys window windows | grep -E ‘mCurrentFocus’ (or) dumpsys window windows | grep -E ‘mFocusedApp’
  7. appPackageActivity
  8. This appPackage and appActivity is important in terms of launching during automation as well as for desired capabilities.

More to Add……….

Please take a look on Installing Android Studio on Windows and Installing Appium Desktop and Setting up Selenium Grid

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s