Summary of commonly used ADB commands in Android development

The full name of adb is Android Debug Bridge, which acts as a debugging bridge. Through adb, we can easily debug Android programs through DDMS in Eclipse, which is a debug tool to put it bluntly. Adb works in a special way. It uses monitoring ports such as Socket TCP 5554 to let IDE communicate with Qemu. By default, adb will daemon-related network ports, so when we run Eclipse, the adb process will automatically run. As a developer, it is very necessary to master the proper required ADB operation commands. Let's make a brief summary of the adb commands that are relatively used in daily work.

1. ADB self-management related commands

adb kill-server terminates the ADB service process

adb start-server Start or restart the ADB service process

adb root Restart the ADB service with root privileges

2. Settings (including emulator) management using ADB

adb devices View devices connected to the computer

adb get-serialno Get the serial number of the device connected to the computer, currently only one device can be connected to get it

adb reboot reboots devices connected to the computer

adb reboot bootloader /recovery reboot the device into fastboot mode or recovery mode, usually used when flashing

adb [-d|-e|-s] command Send the specified command to the specified device, where serialNuber is the device number

3. Get device hardware information

adb shell cat /sys/class/net/wlan0/address to get the wifi mac address

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

adb shell cat /system/build.prop Get device build properties

adb shell cat /data/misc/wifi/*.conf Get device Wi-Fi configuration information

4. 通过设备管理 APP 应用操作

adb install [-r|-s]  安装 apk 文件

adb uninstall [-k] 卸载 APP

adb  shell top [-m ] 查看内存情况,如果有 number 表示查看多少条数据

adb  shell ps 查看进程列表数据

adb shell kill  杀死对应 pid 的进程

adb shell ps -x   查看指定 pid 进行的运行状态

adb  shell  service list 查看后台服务信息

adb  shell cat /proc/meminfo  查看当前内存占用情况

adb  shell cat /proc/iomen 查看 io 内存分区情况

5. 对文件进行操作的相关 adb 命令

adb shell ls mnt  查看所有设备中的存储设备名

adb  remount 将 system 分区重新挂载为可读写分区

adb push 从本地复制文件到设备中 local 和 remote 分别对应本地与设备的文件

adb  pull 从设备复制文件到本地的操作

adb shell ls 查看目录下的所有文件及文件夹

adb shell cd 查看文件夹内容

adb  shell mkdir path/floldername 新建文件

6. 其它操作命令

adb  shell input text  发送文件内容

adb  shell input keyevent  通过 adb 命令发送键盘事件

adb  shell wm size  获取设备分辨率

adb  shell getprop 获取设备参数信息

adb shell setprop 设置设备的参数信息

adb shell screencap -p 使用adb命令进行截屏操作

adb  shell screenrecord [options]    使用 adb 命令进行视屏录制

[options]  可以填写:

size WIDTH*HEIGHT

bit -rete

-time -limit 时间限制等

作者:BetterLater

本文来源:http://blog.csdn.net/true100/article/details/49736481#rd


 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327034117&siteId=291194637