ADB常用命令
adb version 查看adb版本
adb install [-lrtsdg] <file> 安装app
adb install-multiple [-lrtsdpg] <file ... >
adb uninstall [-k] <pakage> 卸载app
adb push <local> <remote> 从PC拷贝东西到设备上
adb pull <remote> <local> 从设备拷贝东西到PC上
adb logcat 设备的日志
adb bugreport 查看bug报告
adb jdwp
adb sync [<directory>]
adb shell 进入设备的shell命令
adb emu
adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] [<packages ... >]
adb restore
adb disable-verity
adb enable-verity
adb keygen <file>
adb forward <local> <remote> 将特定端口上的请求转发到模拟器或手机的指定端口上。
adb forward --no-rebind <local> <remote>
adb forward --list
adb forward --remove <local>
adb forward --remove-all
adb reverse <remote> <local>
adb reverse --norebind <remote> <local>
adb reverse --list
adb reverse --remove <remote>
adb reverse --remove-all
连接设备相关:
adb -a 命令针对所有的设备,需要与命令一起使用,例如 adb -a push <local> <remote>
adb -d 命令针对真机,需要与命令一起使用。如果有多个模拟器或手机,当使用adb命令的时候就需要指定目标设备。
adb -e 命令针对虚拟机,需要与命令一起使用。如果有多个模拟器或手机,当使用adb命令的时候就需要指定目标设备。
adb -s <specific device> 命令针对指定设备,需要与命令一起使用。如果有多个模拟器或手机,当使用adb命令的时候就需要指定目标设备。
adb -p <product name or path>
adb -H 访问其他机器上的adb service
adb -P 访问其他机器上的adb service
adb devices [-l] 列出所有的设备,实际列出的就是设备的serialnumber,可以通过-s指定列出的serialNumber找到对应的设备
adb connect <host>[:<port>]
adb disconnect[<host>[:<port>]]
scripting :
adb wait-for-device
adb start-server 启动adb server
adb kill-server 停止adb server
adb get-state 列出设备状态: offline | bootloader | device
adb get-serialno 列出设备的serial number
adb get-devpath
adb remount 从新挂载系统分区,使其可写(system、vendor、oem目录)
adb reboot [bootloader|recovery]
adb reboot sideload
adb reboot sideload-auto-reboot
adb sideload <file>
adb root 重启adbd并获得root权限
adb unroot 重启adbd并释放root权限
adb usb
adb tcpip <port>
Android系统对应的命令(部分为linux命令)
adb shell am start -n <package_name>/.<activity_class_name> // 启动应用
adb shell top // 查看设备cpu和内存占用情况
adb shell top -m 6 // 查看占用内存前6的app
adb shell top -n 1 // 刷新一次内存信息,然后返回
adb shell procrank // 查询各进程内存使用情况
adb shell kill [pid] // 杀死一个进程
adb shell ps // 查看进程列表
adb shell ps -x [PID] // 查看指定进程状态
emulator命令
可以使用emulator命令启动模拟器。
emulator -avd <avd名称>
emulator -data 镜像文件名称
浙公网安备 33010602011771号