1、查询当前连接了哪些设备(物理、虚拟)
一般含有emulator的设备是虚拟设备
2、将设备的端口映射到PC的端口
如果当前只连接了一台虚拟设备则可以省略-s devices-name参数(以下同上)
4、安装程序
启动
5、卸载程序
查询app
卸载
6、从设备复制文件或目录
7、复制文件或目录至设备
8、断开所有连接得设备
9、连接所有设备
10、获取设备得shell
11、发送按键消息
按下menu键
松开menu键
[table]
|key name|code
|MENU|229
|HOME|102
|BACK (back button)|158
|CALL (call button)|231
|END (end call button)|107
[/table]
adb devices
一般含有emulator的设备是虚拟设备
2、将设备的端口映射到PC的端口
adb -s <devices-name> forward tcp:8080 tcp:8080
如果当前只连接了一台虚拟设备则可以省略-s devices-name参数(以下同上)
4、安装程序
adb install <path_to_apk>
启动
adb shell am start -W -n <apk-package-name>/<apk-package-activity-name>
5、卸载程序
查询app
adb shell
ls data/data
卸载
adb shell pm uninstall -k <apk-package-name>
6、从设备复制文件或目录
adb pull <remote> <local>
7、复制文件或目录至设备
adb push <local> <remote>
8、断开所有连接得设备
adb kill-server
9、连接所有设备
adb start-server
10、获取设备得shell
adb shell
11、发送按键消息
adb shell sendevent <device> <type> <code> <value>
按下menu键
adb shell sendevent /dev/input/event0 1 229 1
松开menu键
adb shell sendevent /dev/input/event0 1 229 0
[table]
|key name|code
|MENU|229
|HOME|102
|BACK (back button)|158
|CALL (call button)|231
|END (end call button)|107
[/table]