Just a blog to share my tricks, code snippets

Friday, March 10, 2017

Some useful adb commands with Android emulators using in mobile automation


Please be notice that below commands are for windows.

  • Manually install the app to the emulator:

adb install path_to_apk
For example:
adb install D:\abc\newapp\VSee-vsee-release.apk
If you have more than 1 emulators, use option 's' to specify the device
>adb devices
List of devices attached
emulator-5554 device
emulator-5555 device

>adb -s emulator-5555 install helloWorld.apk
Note: If you issue a command without specifying a target device when multiple devices are available, adb generates an error.

  • Take a screenshot:

adb shell screencap path_to_save_screenshot
For example:
adb shell screencap /sdcard/screen.png

  • Copy files to/from a device:

To copy a file or directory and its sub-directories from the device
adb pull remote local
For example:
adb pull /sdcard/screen.png .
To copy a file or directory and its sub-directories to the device, do the following:
adb push local remote
For example:
adb push foo.txt /sdcard/foo.txt

For all the adb command, you should check out the Android developer page at HERE

1 comment:

  1. Great article with excellent idea!Thank you for such a valuable article. I really appreciate for this great information.. android-emulators

    ReplyDelete