adb操作命令

1. adb debug

1.1. adb devices

adb devices    # 连接的设备列表
adb devices -l # 连接的设备列表包括设备信息
adb devices -s sn号 # 多个设备使用此方式进行选择

1.2. adb forward

adb forward --list             # list all forward socket connections
adb forward tcp:6123 tcp:7123  #set up port forwarding  sets up forwarding of computer port 6123 to Android device port 7123

1.3. adb kill-server

adb kill-server    # 终止adb服务器进程

2. Wireless

2.1. adb connect

adb tcpip 5555               # 设置端口号
adb connect 192.168.100.217  # 连接设备IP地址
adb devices                  # 查看设备连接状况
adb disconnect ip地址        # 断开

2.2. adb usb

adb usb # 以USB模式重启

3. Package Manager

3.1. adb install

adb install test.apk                                 # 安装apk
adb install-multiple test.apk test2.apk              # 安装多个apk
adb install-multi-package test.apk demo.apk          # 应用安装-将一个或多个软件包推送到设备并自动安装
adb install -r test.apk                              # 替换现有的应用程序 重新安装现有应用程序,保留其数据
adb install -t test.apk                              # 允许测试包
adb install -d test.apk                              # 允许版本代码降级 仅可调试软件包
adb install -g test.apk                              # 授予所有运行时权限 授予应用清单中列出的所有权限
adb install --instant test.apk                       # 将应用程序安装为临时安装应用程序
adb install --fastdeploy test.apk                    # 使用快速部署
adb install --no-streaming test.apk                  # 始终将APK推送到设备并调用软件包管理器作为单独的步骤

3.2. adb uninstall

adb uninstall test.apk            # 卸载apk
adb uninstall -k test.apk         # 删除软件包后保留数据和缓存目录

3.3. adb shell pm list packages

adb shell pm list packages                        # 打印所有安装apk的包名
adb shell pm list packages -f                     # 查看他们相关的APK文件
adb shell pm list packages -a                     # 所有已知的软件包 但不包括APEXes(Android Pony EXpress)
adb shell pm list packages --apex-only            # --apex-only
adb shell pm list packages -d                     # 过滤只显示被禁用的包
adb shell pm list packages -e                     # 过滤只显示启用的包
adb shell pm list packages -s                     # 过滤只显示系统包
adb shell pm list packages -3                     # 过滤以仅显示第三方软件包
adb shell pm list packages -i                     # see the installer for the packages
adb shell pm list packages -l                     # ignored (used for compatibility with older releases)
adb shell pm list packages -U                     # also show the package UID
adb shell pm list packages -u                     # also include uninstalled packages
adb shell pm list packages --show-versioncode     # also show the version code
adb shell pm list packages --uid                  # UID filter to only show packages with the given UID
adb shell pm list packages --user                 # USER_ID  only list packages belonging to the given user

3.4. adb shell pm path

    adb shell pm path 包名

3.5. adb shell pm clear

    adb shell pm clear 包名       # clearing app data, cache

4. File Manager

4.1. adb pull

adb  pull /mnt/sdcard/Download/test.apk pc.apk            # 从设备复制文件/目录
adb  pull -a /mnt/sdcard/Download/test.apk pc.apk         # 保留文件时间戳和模式

4.2. adb push

adb root
adb disable-verity
adb reboot
adb root
adb remount
adb push pc.apk /storage/self/primary/Download/test.apk            # 将本地文件/目录复制到Android设备
adb push --sync pc.apk /mnt/sdcard/Download/test.apk               # 仅推送主机上比Android设备更新的文件

4.3. adb shell 命令

adb shell ls
adb shell cd
adb shell rm
adb shell mkdir
adb shell touch
adb shell pwd
adb shell cp
adb shell mv

5. Network

adb shell netstat
adb shell ping
adb shell netcfg
adb shell ip

6. Logcat

adb logcat
adb shell dumpsys
adb shell dumpstate

7. Screenshot

adb shell screencap /mnt/sdcard/Download/test.png
adb shell screenrecord
adb shell screenrecord --size 1280x720
adb shell screenrecord --bit-rate 4000000
adb shell screenrecord --rotate
adb shell screenrecord --bugreport
adb shell screenrecord --time-limit=120
adb shell screenrecord --verbose

8. System

adb root
adb unroot
adb sideload /mnt/sdcard/Download/ota.zip            # 侧面加载给定的完整OTA软件包
adb shell ps
adb shell top                                        # 实时显示流程活动
adb shell top -H                                     # 显示主题Show threads
adb shell top -o %CPU,%MEM,TIME+                     # Show FIELDS (def PID,USER,PR,NI,VIRT,RES,SHR,S,%CPU,%MEM,TIME+,CMDLINE)
adb shell top -m 50                                  # Maximum number of tasks to show
adb shell getprop
adb shell getprop -T                                 # 显示属性类型而不是值
adb shell getprop gsm.sim.operator.alpha             # 获取SIM卡运营商
adb shell getprop ro.ril.oem.imei                    # 获取设备IEMI
adb shell setprop <key> <value>
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值