`
david_je
  • 浏览: 373850 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

ADB 的其他命令

 
阅读更多

        ADB确实是个好工具,解决offline的问题让我意识到对adb的其他命令最好也有个了解。

        使用adb help可以得到所有的adb命令:

 

       

Android Debug Bridge version 1.0.29

 -d                            - directs command to the only connected USB device
                                 returns an error if more than one USB device is present.
 -e                            - directs command to the only running emulator.
                                 returns an error if more than one emulator is running.
 -s <serial number>            - directs command to the USB device or emulator with
                                 the given serial number. Overrides ANDROID_SERIAL
                                 environment variable.
 -p <product name or path>     - simple product name like 'sooner', or
                                 a relative/absolute path to a product
                                 out directory like 'out/target/product/sooner'.
                                 If -p is not specified, the ANDROID_PRODUCT_OUT
                                 environment variable is used, which must
                                 be an absolute path.
 devices                       - list all connected devices
 connect <host>[:<port>]       - connect to a device via TCP/IP
                                 Port 5555 is used by default if no port number is specified.
 disconnect [<host>[:<port>]]  - disconnect from a TCP/IP device.
                                 Port 5555 is used by default if no port number is specified.
                                 Using this command with no additional arguments
                                 will disconnect from all connected TCP/IP devices.

device commands:
  adb push <local> <remote>    - copy file/dir to device
  adb pull <remote> [<local>]  - copy file/dir from device
  adb sync [ <directory> ]     - copy host->device only if changed
                                 (-l means list but don't copy)
                                 (see 'adb help all')
  adb shell                    - run remote shell interactively
  adb shell <command>          - run remote shell command
  adb emu <command>            - run emulator console command
  adb logcat [ <filter-spec> ] - View device log
  adb forward <local> <remote> - forward socket connections
                                 forward specs are one of:
                                   tcp:<port>
                                   localabstract:<unix domain socket name>
                                   localreserved:<unix domain socket name>
                                   localfilesystem:<unix domain socket name>
                                   dev:<character device name>
                                   jdwp:<process pid> (remote only)
  adb jdwp                     - list PIDs of processes hosting a JDWP transport
  adb install [-l] [-r] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file>
                               - push this package file to the device and install it
                                 ('-l' means forward-lock the app)
                                 ('-r' means reinstall the app, keeping its data)
                                 ('-s' means install on SD card instead of internal storage)
                                 ('--algo', '--key', and '--iv' mean the file is encrypted already)
  adb uninstall [-k] <package> - remove this app package from the device
                                 ('-k' means keep the data and cache directories)
  adb bugreport                - return all information from the device
                                 that should be included in a bug report.

  adb backup [-f <file>] [-apk|-noapk] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]
                               - write an archive of the device's data to <file>.
                                 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.)
                                 (-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)
                                 (<packages...> 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 <file>           - restore device contents from the <file> backup archive

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

scripting:
  adb wait-for-device          - block until device is online
  adb start-server             - ensure that there is a server running
  adb kill-server              - kill the server if it is running
  adb get-state                - prints: offline | bootloader | device
  adb get-serialno             - prints: <serial-number>
  adb status-window            - continuously print device status for a specified device
  adb remount                  - remounts the /system partition on the device read-write
  adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
  adb reboot-bootloader        - reboots the device into the bootloader
  adb root                     - restarts the adbd daemon with root permissions
  adb usb                      - restarts the adbd daemon listening on USB
  adb tcpip <port>             - restarts the adbd daemon listening on TCP on the specified port
networking:
  adb ppp <tty> [parameters]   - Run PPP over USB.
 Note: you should not automatically start a PPP connection.
 <tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
 [parameters] - Eg. defaultroute debug dump local notty usepeerdns

adb sync notes: adb sync [ <directory> ]
  <localdir> can be interpreted in several ways:

  - If <directory> is not specified, both /system and /data partitions will be updated.

  - If it is "system" or "data", only the corresponding partition
    is updated.

environmental variables:
  ADB_TRACE                    - Print debug information. A comma separated list of the following values
                                 1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
  ANDROID_SERIAL               - The serial number to connect to. -s takes priority over this if given.
  ANDROID_LOG_TAGS             - When used with the logcat option, only these debug tags are printed.

 

分享到:
评论

相关推荐

    adb常用命令adb shell常用命令.docx.zip

    "G2"和"H"可能是其他相关文档或文件的名称,它们可能包含更多ADB和shell命令的进阶知识或特定场景的使用技巧。 掌握ADB和`adb shell`命令是Android开发和调试过程中的必备技能,这有助于高效地处理各种设备上的问题...

    adb命令大全.zip

    这个压缩包“adb命令大全.zip”显然包含了关于adb的全面指南,包括adb的安装步骤、基本命令用法以及更高级的使用技巧。让我们深入探讨一下adb及其主要功能。 ### 安装adb 在开始使用adb之前,你需要先将其安装到你...

    Android adb详细命令

    1. **客户端**:运行在开发机器上的应用,如命令行界面、ADT插件或DDMS等,用于发送ADB命令。 2. **服务器**:作为后台进程运行在开发机器上,负责管理和协调客户端与ADB守护程序之间的通信。 3. **守护程序**:以后...

    常用adb命令.docx

    ADB 命令大全 ADB(Android Debug Bridge)是一款强大的命令行工具,用于调试和测试 Android 设备。下面是常用的 ADB 命令大全,涵盖连接设备、查看机型、查找包名、查看 APK 文件路径、文件传输、列出索引正在运行...

    adb操作命令详解及大全

    标签中的“adb命令详解”进一步强调了文档的主要内容,即对ADB命令的详细解读和说明。 在文档的内容部分,首先提到的是通过输入“adb version”来检查ADB环境是否安装正确,以及通过“adb devices”来查看已连接的...

    ADB命令大全.pdf

    ADB 命令大全 ADB(Android 调试桥)是一种多用途的工具,可以帮助开发者管理设备或模拟器的状态。通过使用 ADB 命令,可以实现设备或模拟器...同时,ADB 命令也可以与其他 Android 工具集成,例如 ADT 插件和 DDMS。

    ADB常用命令文档.zip

    以下是一些关键的ADB命令及其详细说明: 1. **连接设备**: - `adb devices`:列出所有已连接的Android设备和它们的状态,包括在线、离线等。 2. **安装应用**: - `adb install 文件路径&gt;`:将APK文件安装到...

    MTK log 和 adb 常用命令

    此文档主要讲解了MTK log 的抓取方式和ADB 命令的使用

    adb shell命令大全

    1.开发中实用的各种adb大全 ,附带例子讲解 2.各种不常见但是也会很有用的adb shell命令

    adb命令截屏、返回按键、获取顶层activity

    在这个主题中,我们将深入探讨如何使用adb命令来实现屏幕截图、模拟返回按键以及获取设备上的顶层Activity。 1. **adb命令截屏** 要使用adb命令截屏,你需要确保你的设备已经开启了USB调试,并通过USB连接到电脑。...

    SpringBoot执行adb命令连接手机执行

    本文将深入探讨如何利用SpringBoot框架来执行ADB命令,实现对连接的Android手机进行操作,如关机、重启、进入recovery模式和fastboot模式等。 首先,让我们了解ADB的基本用法。ADB由三个部分组成:服务器、守护进程...

    Android常用adb命令集锦

    "Android常用adb命令集锦" Android 平台中,ADB 命令是非常重要的一部分,它提供了许多实用的功能,可以帮助开发者更方便地管理和调试 Android 设备或模拟器。下面将对常用的 ADB 命令进行总结和解释。 1. android...

    usb host 实现adb shell 命令发送

    在Android系统中,ADB(Android Debug Bridge)是一个强大的工具,用于开发者进行设备调试、文件传输以及执行各种shell命令。USB Host模式则是Android设备作为一个主机,连接其他USB设备,如键盘、鼠标或者数据采集...

    android ADB命令使用

    ### Android ADB命令使用详解 #### 概述 Android Debug Bridge (ADB) 是一款功能强大的命令行工具,它能够帮助开发者管理和调试Android设备或模拟器的状态。本文将详细介绍ADB的基本概念、常用命令及其应用场景。 ...

    android执行adb shell命令源码

    虽然这个例子没有涉及`adb`,但在实际应用中,你可以先通过`adb connect`命令建立与设备的连接,然后在原生层执行`adb shell`命令。 总结来说,Android应用执行`adb shell`命令主要依赖于Java层的`Runtime`或`...

    ADB命令.txt

    ### ADB命令详解 #### 一、ADB简介 ADB(Android Debug Bridge)是Android开发者不可或缺的强大工具之一。作为连接Android设备与PC机之间的桥梁,它为Android应用的开发与调试提供了便利。通常,ADB被集成在...

    adb常用命令.docx

    ##### 2.4 其他常用命令 - **帮助信息**: `adb help` - **重启设备**: `adb reboot` - **重新挂载system分区**: `adb remount` - **终止ADB服务**: `adb kill-server` - **重启ADB服务**: `adb start-server` - **...

    adb常用命令.pdf

    ### ADB常用命令详解 #### 一、ADB基础命令 ADB (Android Debug Bridge) 是一个命令行工具...这些ADB命令是Android开发者进行调试、测试和故障排查时必不可少的工具。通过熟练掌握这些命令,可以极大地提高工作效率。

Global site tag (gtag.js) - Google Analytics