adb常用命令介绍

adb connect

命令格式:adb connect <host>[:<port>]
作用:connect to a device via TCP/IP,Port 5555 is used by default if no port number is specified.
通过TCP/IP连接到远程设备
例子:连接到IP为192.168.2.99的设备
adb connect 192.168.2.99

adb disconnect

命令格式:adb disconnect [<host>[:<port>]]
作用:disconnect from a TCP/IP device,断开设备连接
例子:与IP为192.168.2.99的设备断开连接
adb disconnect 192.168.2.99

adb devices

命令格式:adb devices
作用:list all connected devices,列出当前已连接的设备。

adb pull

命令格式:adb pull <remote> [<local>]
作用:copy file/dir from device,从设备复制文件或目录到本地服务器或电脑 
例子:将设备上/storage/ScreenRecorder/video.mp4文件复制到本地服务器的/home/roger/tmp/video.mp4 
adb pull /storage/ScreenRecorder/video.mp4 /home/roger/tmp/video.mp4

adb push

命令格式:adb push <local> <remote>
作用:copy file/dir to device,从本地复制文件或目录到设备
例子:adb push /home/roger/tmp/video.mp4 /storage/ScreenRecorder/video.mp4

注:adb pull/adb push复制过程中可以更改文件或目录名字

adb shell

作用:run remote shell interactively,运行远程shell交互
注:在shell环境下可以指向linux的文件管理命令,进行文件的删除、复制、移动等操作。

adb shell <command>

作用:运行远程shell指令

adb shell rm filename

作用:删除设备上的文件或目录
例子:删除/storage/emulated/0/ScreenRecorder/tt.mp4
adb shell rm /storage/emulated/0/ScreenRecorder/tt.mp4

adb install

命令格式:adb install [-lrtsdg] <file>
作用:push this package file to the device and install it,安装指定apk到设备
参数:(-l: forward lock application)
    (-r: replace existing application)安装时app已经存在,使用新版本代替
    (-t: allow test packages)
    (-s: install application on sdcard)
    (-d: allow version code downgrade)
    (-g: grant all runtime permissions)
例子:安装ScreenRecorder.apk到设备

adb install ScreenRecorder.apk

注:使用ScreenRecorder.apk所在目录路径,或切换到ScreenRecorder.apk所在目录

adb uninstall

命令格式:adb uninstall [-k] <package>
作用:remove this app package from the device,卸载指定包名的app
参数:('-k' means keep the data and cache directories)保留该app的数据和目录
例子:将包名为com.roger.screenrecorder的app卸载

adb uninstall com.roger.screenrecorder



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值