zoukankan      html  css  js  c++  java
  • android adb 通过adb连接制定设备

    (移植android OS 到 openwrt)

    确保linux能够识别adb命令,请自行添加环境变量。

    root@Ray:/home/floyd/adt-bundle-linux/sdk/platform-tools# ./adb devices -l
    List of devices attached 
    02a0251d               device usb:2-1.1

    注,确保adb运行权限为root,否则

    floyd@Ray:~/adt-bundle-linux/sdk/platform-tools$ ./adb devices -l
    List of devices attached 
    ????????????           no permissions usb:2-1.1

    且无法使用adb -s  device_id shell连接设备。

    root@Ray:/home/floyd/adt-bundle-linux/sdk/platform-tools# ./adb -s 02a0251d shell
    $ ls
    acct                 init.goldfish.rc     sbin
    cache                init.qcom.rc         sd-ext
    config               init.qcom.sh         sdcard
    d                    init.rc              sys
    data                 init.target.rc       system
    default.prop         mnt                  ueventd.goldfish.rc
    dev                  persist              ueventd.rc
    etc                  proc                 vendor
    init                 root

    如何连接开发板

    adb connect 192.168.1.2:5555 #端口5555,192.168.1.2为开发板IP
    adb shell #进入终端模式

    adb的关闭与启动

    root@Ray:/home/floyd/adt-bundle-linux/sdk/platform-tools# ./adb kill-server
    root@Ray:/home/floyd/adt-bundle-linux/sdk/platform-tools# ./adb start-server

    与设备之间文件的传输

    adb push <本机文件目录> <设备文件目录>

    adb pull <本机文件目录> <设备文件目录>

    安装APK程序到设备

    adb install <APK文件路径>

    连接到Android设备后请求root权限,su,如果手机的话,注意在手机上允许root权限请求。

    默认下apk软件安装到/data/app

    adb命令启动Android程序

    adb shell am start -n breakan.test/breakan.test.TestActivity

    其中"breakan.test/breakan.test.TestActivity"中的"breakan.test"是程序的包名,"TestActivity"是程序Activity类的类名。

    usage: am [subcommand] [options]
    
        start an Activity: am start [-D] [-W] <INTENT>
            -D: enable debugging
            -W: wait for launch to complete
    
        start a Service: am startservice <INTENT>
    
        send a broadcast Intent: am broadcast <INTENT>
    
        start an Instrumentation: am instrument [flags] <COMPONENT>
            -r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT)
            -e <NAME> <VALUE>: set argument <NAME> to <VALUE>
            -p <FILE>: write profiling data to <FILE>
            -w: wait for instrumentation to finish before returning
    
        start profiling: am profile <PROCESS> start <FILE>
        stop profiling: am profile <PROCESS> stop
    
        <INTENT> specifications include these flags:
            [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
            [-c <CATEGORY> [-c <CATEGORY>] ...]
            [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
            [--esn <EXTRA_KEY> ...]
            [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
            [-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
            [-n <COMPONENT>] [-f <FLAGS>]
            [--grant-read-uri-permission] [--grant-write-uri-permission]
            [--debug-log-resolution]
            [--activity-brought-to-front] [--activity-clear-top]
            [--activity-clear-when-task-reset] [--activity-exclude-from-recents]
            [--activity-launched-from-history] [--activity-multiple-task]
            [--activity-no-animation] [--activity-no-history]
            [--activity-no-user-action] [--activity-previous-is-top]
            [--activity-reorder-to-front] [--activity-reset-task-if-needed]
            [--activity-single-top]
            [--receiver-registered-only] [--receiver-replace-pending]
            [<URI>]

     

  • 相关阅读:
    各种算法七
    各种算法六
    使用URLConnection调用axis1.4开发的webservice
    JDBC结果集rs.next()注意事项
    URLConnection调用接口
    axis1.4开发webservice客户端(快速入门)-基于jdk1.4
    axis1.4开发webservice服务端(快速入门)-基于jdk1.4
    FMDB数据库的简单实用
    Xcode5 取消项目ARC,或者单个类ARC切换
    用CornerStone配置SVN,HTTP及svn简单使用说明
  • 原文地址:https://www.cnblogs.com/rayfloyd/p/2779813.html
Copyright © 2011-2022 走看看