Android笔记(五)(adb使用)

Android笔记(五)(adb使用),第1张

Android笔记(五)(adb使用) 1. 添加环境变量

此电脑(右击)→ 属性 → 高级系统设置 → 高级 → 环境变量 → 系统变量 → Path(双击)

→新建添加 adb.exe路径

2. adb常用指令

adb devices  当前连接了几个设备以及每个连接的状态

shell []   连接模拟器/设施执行Shell命令,执行完毕后退出远程Shell端l

adb shell pm list packages  列出手机装的所有app的包名 

    device commands 

adb push ... 复制文件/目录到设备adb pull [-a] ... 从设备复制文件/目录  adb sync [ ]     复制主机内容到设备,仅在改变时(-l 列出但不复制)  adb shell [-e escape] [-n] [-Tt] [-x] [command]

                               运行远程shell命令 (如果没有给出命令,则使用交互式shell)
                                 (-e: choose escape character, or "none"; default '~')
                                 (-n: don't read from stdin)
                                 (-T: disable PTY allocation)
                                 (-t: force PTY allocation)
                                 (-x: disable remote exit codes and stdout/stderr separation)

  adb emu  运行模拟器控制台命令  adb logcat [ ]   查看设备日志  adb forward --list       列出所有远程socket连接

                                 the format is a list of lines with the following format:
                                    " " " " "n"

  adb forward - forward socket connections

                                 forward specs are one of:
                                   tcp:
                                   localabstract:
                                   localreserved:
                                   localfilesystem:
                                   dev:
                                   jdwp: (remote only)

  adb forward --no-rebind

                               - same as 'adb forward ' but fails
                                 if is already forwarded

  adb forward --remove - remove a specific forward socket connection  adb forward --remove-all     - remove all forward socket connections  adb reverse --list           - list all reverse socket connections from device  adb reverse - reverse socket connections

                                 reverse specs are one of:
                                   tcp:
                                   localabstract:
                                   localreserved:
                                   localfilesystem:

  adb reverse --no-rebind

                               - same as 'adb reverse ' but fails
                                 if is already reversed.

  adb reverse --remove

                               - remove a specific reversed socket connection

  adb reverse --remove-all     - remove all reversed socket connections from device  adb jdwp                     - list PIDs of processes hosting a JDWP transport  adb install [-lrtsdg]

                               把安装包发送到设备并安装
                                 (-l: “L”意味着锁的应用程序)
                                 (-r: “R”意味着重新安装应用程序,保持其数据)
                                 (-t: allow test packages)
                                 (-s: “S”是指安装在SD卡代替内部存储)
                                 (-d: allow version code downgrade (debuggable packages only))
                                 (-g: grant all runtime permissions)

  adb install-multiple [-lrtsdpg]

                               - push this package file to the device and install it
                                 (-l: forward lock application)
                                 (-r: replace existing application)
                                 (-t: allow test packages)
                                 (-s: install application on sdcard)
                                 (-d: allow version code downgrade (debuggable packages only))
                                 (-p: partial application install)
                                 (-g: grant all runtime permissions)

  adb uninstall [-k]   卸载应用程序

                                 (“K”意味着保持数据和缓存目录)

  adb bugreport []   返回设备上的一个bug报告的所有信息    

                                 If is a file, the bug report will be saved as that file.
                                 If is a directory, the bug report will be saved in that directory with the name provided by th
e device.
                                 If is omitted, the bug report will be saved in the current directory with the name provided by
 the device.
                                 NOTE: if the device does not support zipped bug reports, the bug report will be output on stdout.
  adb backup [-f ] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] []
                               - write an archive of the device's data to .
                                 If no -f option is supplied then the data is written
                                 to "backup.ab" in the current directory.
                                 (-apk|-noapk enable/disable backup of the .apks themselves
                                    in the archive; the default is noapk.)
                                 (-obb|-noobb enable/disable backup of any installed apk expansion
                                    (aka .obb) files associated with each application; the default
                                    is noobb.)
                                 (-shared|-noshared enable/disable backup of the device's
                                    shared storage / SD card contents; the default is noshared.)
                                 (-all means to back up all installed applications)
                                 (-system|-nosystem toggles whether -all automatically includes
                                    system applications; the default is to include system apps)
                                 ( is the list of applications to be backed up.  If
                                    the -all or -shared flags are passed, then the package
                                    list is optional.  Applications explicitly given on the
                                    command line will be included even if -nosystem would
                                    ordinarily cause them to be omitted.)

  adb restore           - restore device contents from the backup archive  adb disable-verity           - disable dm-verity checking on USERDEBUG builds  adb enable-verity            - re-enable dm-verity checking on USERDEBUG builds  adb keygen            - generate adb public/private key. The private key is stored in ,

                                 and the public key is stored in .pub. Any existing files
                                 are overwritten.

  adb help                     - show this help message  adb version                  - show version num

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5709618.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存