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)
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
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
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
- Plug the device1.
- To list the devices connected to PC “adb devices”.
- Set the target device to listen for a TCP/IP connection on port 5555 for eg., “adb tcpip 5555”.
- Unplug the device 1.
- Repeat step no.1 to step no.4 for multiple devices.
- Go to settings of your devices and find its IP addresses.
- Connect to the device by its IP address. “adb connect IPAddress:5555“
- Now, list the devices. The following devices connected via Wifi
How to find appPackage and appActivity name?
- Connect a device to PC
- Find the udid using command “adb devices”
- Run command “adb shell”
- Now, open your App before supply next command, for eg., I open calculator App
- dumpsys window windows | grep -E ‘mCurrentFocus’ (or) dumpsys window windows | grep -E ‘mFocusedApp’
- 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