adb 常用命令

来源:互联网 发布:硬盘坏了数据恢复 编辑:程序博客网 时间:2024/05/18 22:10

adb 常用命令

 (2012-12-14 15:03:49)
转载
标签: 

杂谈

分类: 移动测试
    -d                            - directs command to the only connected USB device
                                  --直接命令给USB链接的设备
                                     returns an error if more than one USB device is present.
                                  如果多于1个USB设备会报错
    -e                            - directs command to the only running emulator.
                                    直接指令给正在运行的虚拟机
                                     returns an error if more than one emulator is running.
                                   如果有多于1个虚拟机,会报错
    -s             - directs command to the USB device or emulator with
                                     the given serial number
                                   直接指令给USB设备或者虚拟机,按照给定的序列号
    -p      - simple product name like 'sooner', or a relative/absolute path to a product out directory like

'out/target/product/sooner'.
 
                简单的产品名字 如“sooner”,或者一个产品相对/直接路径如“out/target/product/sooner”

                                     If -p is not specified, the ANDROID_PRODUCT_OUT   environment variable is used,

which must   be an absolute path.
                如果 -p不是特殊的,   ANDROID_PRODUCT_OUT的环境变量正在使用,那么必须是绝对路径。
    devices                       - list all connected devices
                                    列出所有连接的设备。

    device commands:
      adb push     - copy file/dir to device    拷贝文件/路径到设备
      adb pull     - copy file/dir from device   从设备拷贝文件/路径
      adb sync [ ]     - copy host->device only if changed
                                     (see 'adb help all')
                         如果有改变,拷贝设备主机
      adb shell                    - run remote shell interactively
                                       运行远程交互
      adb shell           - run remote shell command
                                  运行远程命令
      adb emu             - run emulator console command
                                    运行虚拟机界面命令
      adb logcat [ ] - View device log
                          查看设备日志
      adb forward - forward socket connections     Socket端口连接
                                     forward specs are one of:
                                       tcp:
                                       localabstract:
                                       localreserved:
                                       localfilesystem:
                                       dev:
                                       jdwp: (remote only)
      adb jdwp                     - list PIDs of processes hosting a JDWP transport
                                       PIDS过程在JDWP端口的列表

      adb install [-l] [-r] - push this package file to the device and instal
    l it
                                     ('-l' means forward-lock the app)
                                      锁定应用程序
                                     ('-r' means reinstall the app, keeping its data)
                                       重新安装,并保留原数据
      adb uninstall [-k] - remove this app package from the device  卸载
                                     ('-k' means keep the data and cache directories)  -k  保留数据和缓存目录
      adb bugreport                - return all information from the device  返回所有的数据
                                     that should be included in a bug report. 将是一个很大的报告。

      adb help                     - show this help message   显示这个帮主信息
      adb version                  - show version num  显示版本号

    DATAOPTS:
    (no option)                   - don't touch the data partition 别接触数据分区
      -w                           - wipe the data partition  删除数据分区
      -d                           - flash the data partition 闪存数据分区

    ing:
      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:
      adb status-window            - continuously print device status for a specifie  持续显示设备状态
    d device
      adb remount                  - remounts the /system partition on the device read-write  重装系统设备分区的读写
      adb root                     - restarts adb with root permissions  重新打开有根目录权限的adb

    networking:
      adb ppp [parameters]   - Run PPP over USB.
    Note: you should not automatically start a PDP connection.  你不可以自动启动PDP链接
    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 [ ]
       can be interpreted in several ways:

      - If is not specified, both /system and /data partitions will be u
    pdated.

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



常用命令

    adb shell - 登录设备shell,后面也可直接跟运行命令。如:adb shell rm -r /system/sd/app
    adb pull - 从手机中下载文件到电脑上。如:adb pull /data/app_s/Stock.apk C:\\Stock.apk
    adb push - 从电脑中上传文件到手机上。如:adb push C:\\Stock.apk /data/app_s/Stock.apk
    adb install - 安装软件到手机上。如:adb install C:\\apps2sd.apk
    adb uninstall - 卸载手机上的软件。如:adb uninstall linda.apk
原创粉丝点击