Appium - adb command operation

1.Android Debug Bridge
adb (Android Debug Bridge) is a generic command-line tool, which allows you to simulator instance or Android device connected for communication. It provides convenient operations for a variety of devices, such as installation and debugging applications.

Works of 2.adb
start a adb client, the client first checks adb server process already running. If not, it starts the server process. When the server is started, it is bound to a local TCP port 5037 and listens for commands sent from adb client - all adb clients use port 5037 to communicate with the adb server.

3. Enable adb debugging
developer mode

4.adb commonly used commands

1. Check the version of adb
adb version

2. Connect simulator
adb connect 192.168.56.101:5555

3. View device information
adb devices

4. acquisition device ID and serial number

adb get-serialno

5. Reboot

adb reboot

6. restart the bootloader, i.e. Brush mode

adb reboot BootLoader

7. restart the bootloader, i.e. recovery mode

adb reboot recovery

8. Termination adb server process

adb kill-server

9. restart the adb server process

adb start-server

10. have root privileges to restart the adb Service

adb root

11. Before the simulator / reproduced in the command device is connected to a command vessel adb

adb wait-for-device

12. Install and Uninstall

adn install apkfile / uninstall  package

adb install -r apk retain data and cache files, re-install apk

adb install -s apk sd card to install apk

adb uninstall -k package uninstall app but keep the data and cache files

13.push and pull

adb push from a local copy files to the device

adb pull from the device to copy files to a local

As appears adn push permission denied or read-only filesystem,

You need to mount, adb remount // speaking remount the system partition read-write partition

5、adb shell

android linux system is the underlying device.
shell is the character interface linux system.

adb shell cat / sys / class / net / wlan0 / address // get mac address

adb shell cat / proc / cpuinfo // get cpu serial number

aapt dunp badging apkfile // get the apk packagename and ClassName

adb shell top // View device cpu and memory usage

adb shell top -m 6 // View app take up memory before 6

adb shell procrank // query the memory usage of each process

adb shell kill pid // kill a process

adb shell ps // Check the list of processes

adb shell ps -x [pid] // specified process status

adb shell service list // background check service information

adb shell cat / proc / meminfo // view the current memory usage

adb shell cat / proc / iomem // View IO memory partition occupancy

adb shell am start -n packae_name / .Activity_class_name // application startup app

adb shell ls mnt // name to view all storage devices

adb shell mkidr path / folder name // New Folder

adb shell cat file // view the file contents

 

Guess you like

Origin www.cnblogs.com/Teachertao/p/11258837.html