adb命令

来源:互联网 发布:sql select as 编辑:程序博客网 时间:2024/05/21 08:40

第一篇:adb shell am 的用法(转子:http://blog.csdn.net/fulinwsuafcie/article/details/8092459)

adb shell am 的功能
adb shell am
使用此命令可以从cmd控制台启动 activity, services;发送 broadcast等等:
C:\Users\Administrator>adb shell am
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

    start monitoring: am monitor [--gdb <port>]
        --gdb: start gdbserv on the given port at crash/ANR

    <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>]


使用实例:
如启动一个 Activity:

格式:
adb shell am start -n 包名/包名+类名(-n 类名,-a action,-d date,-m MIME-TYPE,-c category,-e 扩展数据,等)。
 
实例1:
C:\Users\Administrator>adb shell am start -n com.android.camera/.Camera
Starting: Intent { cmp=com.android.camera/.Camera }
 
实例2:(带extra 的 intent)
C:\Users\Administrator>adb shell am start -n com.android.camera/.Camera -e abc hello
Starting: Intent { cmp=com.android.camera/.Camera (has extras) }
其中 extra 的 key 为 abc ,value 为字串 "hello"


第二篇: adb shell pm 命令(转自:http://blog.sina.com.cn/s/blog_4e9b076e01016d8a.html)

adb shell pm 命令详细

usage: pm list packages [-f] [-d] [-e] [-s] [-3] [-i] [-u] [FILTER]

       pm list permission-groups

       pm list permissions [-g] [-f] [-d] [-u] [GROUP]

       pm list instrumentation [-f] [TARGET-PACKAGE]

       pm list features

       pm list libraries

       pm path PACKAGE

       pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f]

                  [--algo --key --iv ] PATH

       pm uninstall [-k] PACKAGE

       pm clear PACKAGE

       pm enable PACKAGE_OR_COMPONENT

       pm disable PACKAGE_OR_COMPONENT

       pm disable-user PACKAGE_OR_COMPONENT

       pm grant PACKAGE PERMISSION

       pm revoke PACKAGE PERMISSION

       pm set-install-location [0/auto] [1/internal] [2/external]

       pm get-install-location

       pm set-permission-enforced PERMISSION [true|false]



pm list packages: prints all packages, optionally only

  those whose package name contains the text in FILTER.  Options:

    -f: see their associated file.

    -d: filter to only show disbled packages.

    -e: filter to only show enabled packages.

    -s: filter to only show system packages.

    -3: filter to only show third party packages.

    -i: see the installer for the packages.

    -u: also include uninstalled packages.



pm list permission-groups: prints all known permission groups.



pm list permissions: prints all known permissions, optionally only

  those in GROUP.  Options:

    -g: organize by group.

    -f: print all information.

    -s: short summary.

    -d: only list dangerous permissions.

    -u: list only the permissions users will see.



pm list instrumentation: use to list all test packages; optionally

  supply to list the test packages for a particular

  application.  Options:

    -f: list the .apk file for the test package.



pm list features: prints all features of the system.



pm path: print the path to the .apk of the given PACKAGE.



pm install: installs a package to the system.  Options:

    -l: install the package with FORWARD_LOCK.

    -r: reinstall an exisiting app, keeping its data.

    -t: allow test .apks to be installed.

    -i: specify the installer package name.

    -s: install package on sdcard.

    -f: install package on internal flash.



pm uninstall: removes a package from the system. Options:

    -k: keep the data and cache directories around after package removal.



pm clear: deletes all data associated with a package.



pm enable, disable, disable-user: these commands change the enabled state

  of a given package or component (written as "package/class").



pm grant, revoke: these commands either grant or revoke permissions

  to applications.  Only optional permissions the application has

  declared can be granted or revoked.



pm get-install-location: returns the current install location.

    0 [auto]: Let system decide the best location

    1 [internal]: Install on internal device storage

    2 [external]: Install on external media



pm set-install-location: changes the default install location.

  NOTE: this is only intended for debugging; using this can cause

  applications to break and other undersireable behavior.

    0 [auto]: Let system decide the best location

    1 [internal]: Install on internal device storage

    2 [external]: Install on external media

第三篇:Android系统在超级终端下必会的命令大全(adb shell命令大全):转自:http://blog.csdn.net/neiloid/article/details/7037093

第四篇:http://changxianli6121.blog.163.com/blog/static/56392130201322805518442/

第五篇:adb logcat 基本用法:http://blog.csdn.net/fulinwsuafcie/article/details/8028572

0 0