ADB(Android debug bridge)可用于管理设备的状态。它的主要功能有:
- 更新设备或手机模拟器中的代码,如应用或Android系统升级;
- 在设备上运行Shell命令;
- 管理设备或手机模拟器上的预定端口;
- 在设备或手机模拟器上复制或粘贴文件。
什么是Shell?
A shell is a user interface for access to an operating system’s services[1].
常用ADB命令
- 查看版本信息
D:\unsetup\android-sdk-windows-1.0_r1\tools>adb version
输出:
Android Debug Bridge version 1.0.20 - 安装应用到模拟器
adb install - 删除应用
adb uninstall package
其中package为包名 - 执行Shell命令
adb shell command
其中command为shell命令 - 转发端口
adb forward tcp:7100 tcp:8100 - 从设备中复制文件或目录
adb pull remote local
例:adb pull /sdcard/foo.txt foo.txt - 将文件或目录复制到设备
adb push local remote
例:adb push foo.txt /sdcard/foo.txt - 查看logcat
adb logcat - 启动adb服务进程
adb start-server - 终止adb服务进程
adb kill-server