一、am的含义是activityManager
主要作用是启动activity、service 、broadcast 
 
1.通过adb命令启动acitvity,首先需要设置activity 的 exported 属性为true,不写默认为false
如果不设置为true 则执行命令是报错:java.lang.SecurityException: Permission Denial: starting Intent
2.在命令行输入 adb shell am start -n 包名/全路径 (-n可以省略)
或者 adb shell am start -a action名称  来启动activity
 
start 时的命令包括
<INTENT> specifications include these flags and arguments:
    [-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> ...]
    [--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
    [--el <EXTRA_KEY> <EXTRA_LONG_VALUE> ...]
    [--ef <EXTRA_KEY> <EXTRA_FLOAT_VALUE> ...]
    [--eu <EXTRA_KEY> <EXTRA_URI_VALUE> ...]
    [--ecn <EXTRA_KEY> <EXTRA_COMPONENT_NAME_VALUE>]
    [--eia <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]
        (mutiple extras passed as Integer[])
    [--eial <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]
        (mutiple extras passed as List<Integer>)
    [--ela <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]
        (mutiple extras passed as Long[])
    [--elal <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]
        (mutiple extras passed as List<Long>)
    [--efa <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]
        (mutiple extras passed as Float[])
    [--efal <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]
        (mutiple extras passed as List<Float>)
    [--esa <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]
        (mutiple extras passed as String[]; to embed a comma into a string,
         escape it using "\,")
    [--esal <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]
        (mutiple extras passed as List<String>; to embed a comma into a string,
         escape it using "\,")
    [--f <FLAG>]
    [--grant-read-uri-permission] [--grant-write-uri-permission]
    [--grant-persistable-uri-permission] [--grant-prefix-uri-permission]
    [--debug-log-resolution] [--exclude-stopped-packages]
    [--include-stopped-packages]
    [--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] [--activity-clear-task]
    [--activity-task-on-home]
    [--receiver-registered-only] [--receiver-replace-pending]
    [--receiver-foreground]
    [--selector]
    [<URI> | <PACKAGE> | <COMPONENT>]
 
启动时间查看:
C:\Users\Administrator>adb shell am start -W com.xx.xx/.module.login.Spla
shActivity
  • WaitTime: 返回从 startActivity 到应用第一帧完全显示这段时间. 就是总的耗时,包括前一个应用 Activity pause 的时间和新应用启动的时间;
  • ThisTime: 表示一连串启动 Activity 的最后一个 Activity 的启动耗时;
  • TotalTime: 表示新应用启动的耗时,包括新进程的启动和 Activity 的启动,但不包括前一个应用Activity pause的耗时。
 
am包含的命令:
am start: start an Activity.  Options are:
    -D: enable debugging
    -N: enable native debugging
    -W: wait for launch to complete 可以用来观察app启动时间
    --start-profiler <FILE>: start profiler and send results to <FILE>
    --sampling INTERVAL: use sample profiling with INTERVAL microseconds
        between samples (use with --start-profiler)
    -P <FILE>: like above, but profiling stops when app goes idle
    -R: repeat the activity launch <COUNT> times.  Prior to each repeat,
        the top activity will be finished.
    -S: force stop the target app before starting the activity
    --track-allocation: enable tracking of object allocations
    --user <USER_ID> | current: Specify which user to run as; if not
        specified then run as the current user.
    --stack <STACK_ID>: Specify into which stack should the activity be put.
am startservice: start a Service.  Options are:
    --user <USER_ID> | current: Specify which user to run as; if not
        specified then run as the current user.
 
am stopservice: stop a Service.  Options are:
    --user <USER_ID> | current: Specify which user to run as; if not
        specified then run as the current user.
 
am force-stop: force stop everything associated with <PACKAGE>.
    --user <USER_ID> | all | current: Specify user to force stop;
        all users if not specified.
 
am kill: Kill all processes associated with <PACKAGE>.  Only kills.
  processes that are safe to kill -- that is, will not impact the user
  experience.
    --user <USER_ID> | all | current: Specify user whose processes to kill;
        all users if not specified.
 
am kill-all: Kill all background processes.
 
am broadcast: send a broadcast Intent.  Options are:
    --user <USER_ID> | all | current: Specify which user to send to; if not
        specified then send to all users.
    --receiver-permission <PERMISSION>: Require receiver to hold permission.
 
am instrument: start an Instrumentation.  Typically this target <COMPONENT>
  is the form <TEST_PACKAGE>/<RUNNER_CLASS> or only <TEST_PACKAGE> if there
  is only one instrumentation.  Options are:
    -r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT).  Use with
        [-e perf true] to generate raw output for performance measurements.
    -e <NAME> <VALUE>: set argument <NAME> to <VALUE>.  For test runners a
        common form is [-e <testrunner_flag> <value>[,<value>...]].
    -p <FILE>: write profiling data to <FILE>
    -w: wait for instrumentation to finish before returning.  Required for
        test runners.
    --user <USER_ID> | current: Specify user instrumentation runs in;
        current user if not specified.
    --no-window-animation: turn off window animations while running.
    --abi <ABI>: Launch the instrumented process with the selected ABI.
        This assumes that the process supports the selected ABI.
 
am trace-ipc: Trace IPC transactions.
  start: start tracing IPC transactions.
  stop: stop tracing IPC transactions and dump the results to file.
    --dump-file <FILE>: Specify the file the trace should be dumped to.
 
am profile: start and stop profiler on a process.  The given <PROCESS> argument
  may be either a process name or pid.  Options are:
    --user <USER_ID> | current: When supplying a process name,
        specify user of process to profile; uses current user if not specified.
 
am dumpheap: dump the heap of a process.  The given <PROCESS> argument may
  be either a process name or pid.  Options are:
    -n: dump native heap instead of managed heap
    --user <USER_ID> | current: When supplying a process name,
        specify user of process to dump; uses current user if not specified.
 
am set-debug-app: set application <PACKAGE> to debug.  Options are:
    -w: wait for debugger when application starts
    --persistent: retain this value
 
am clear-debug-app: clear the previously set-debug-app.
 
am set-watch-heap: start monitoring pss size of <PROCESS>, if it is at or
    above <HEAP-LIMIT> then a heap dump is collected for the user to report
 
am clear-watch-heap: clear the previously set-watch-heap.
 
am bug-report: request bug report generation; will launch a notification
    when done to select where it should be delivered. Options are:
   --progress: will launch a notification right away to show its progress.
 
am monitor: start monitoring for crashes or ANRs.
    --gdb: start gdbserv on the given port at crash/ANR
 
am hang: hang the system.
    --allow-restart: allow watchdog to perform normal system restart
 
am restart: restart the user-space system.
 
am idle-maintenance: perform idle maintenance now.
 
am screen-compat: control screen compatibility mode of <PACKAGE>.
 
am package-importance: print current importance of <PACKAGE>.
 
am to-uri: print the given Intent specification as a URI.
 
am to-intent-uri: print the given Intent specification as an intent: URI.
 
am to-app-uri: print the given Intent specification as an android-app: URI.
 
am switch-user: switch to put USER_ID in the foreground, starting
  execution of that user if it is currently stopped.
 
am start-user: start USER_ID in background if it is currently stopped,
  use switch-user if you want to start the user in foreground.
 
am stop-user: stop execution of USER_ID, not allowing it to run any
  code until a later explicit start or switch to it.
  -w: wait for stop-user to complete.
  -f: force stop even if there are related users that cannot be stopped.
 
am stack start: start a new activity on <DISPLAY_ID> using <INTENT>.
 
am stack movetask: move <TASK_ID> from its current stack to the top (true) or
bottom (false) of <STACK_ID>.
 
am stack resize: change <STACK_ID> size and position to <LEFT,TOP,RIGHT,BOTTOM>.
 
 
am stack resize-docked-stack: change docked stack to <LEFT,TOP,RIGHT,BOTTOM>
   and supplying temporary different task bounds indicated by
   <TASK_LEFT,TOP,RIGHT,BOTTOM>
 
am stack size-docked-stack-test: test command for sizing docked stack by
   <STEP_SIZE> increments from the side <l>eft, <t>op, <r>ight, or <b>ottom
   applying the optional [DELAY_MS] between each step.
 
am stack move-top-activity-to-pinned-stack: moves the top activity from
   <STACK_ID> to the pinned stack using <LEFT,TOP,RIGHT,BOTTOM> for the
   bounds of the pinned stack.
 
am stack positiontask: place <TASK_ID> in <STACK_ID> at <POSITION>
am stack list: list all of the activity stacks and their sizes.
 
am stack info: display the information about activity stack <STACK_ID>.
 
am stack remove: remove stack <STACK_ID>.
 
am task lock: bring <TASK_ID> to the front and don't allow other tasks to run.
 
am task lock stop: end the current task lock.
 
am task resizeable: change resizeable mode of <TASK_ID>.
   0 (unresizeable) | 1 (crop_windows) | 2 (resizeable) | 3 (resizeable_and_pipa
ble)
 
am task resize: makes sure <TASK_ID> is in a stack with the specified bounds.
   Forces the task to be resizeable and creates a stack if no existing stack
   has the specified bounds.
 
am task drag-task-test: test command for dragging/moving <TASK_ID> by
   <STEP_SIZE> increments around the screen applying the optional [DELAY_MS]
   between each step.
 
am task size-task-test: test command for sizing <TASK_ID> by <STEP_SIZE>   incre
ments within the screen applying the optional [DELAY_MS] between
   each step.
 
am get-config: retrieve the configuration and any recent configurations
  of the device.
am suppress-resize-config-changes: suppresses configuration changes due to
  user resizing an activity/task.
 
am set-inactive: sets the inactive state of an app.
 
am get-inactive: returns the inactive state of an app.
 
am send-trim-memory: send a memory trim event to a <PROCESS>.
 
am get-current-user: returns id of the current foreground user.
 
二、pm的含义package manager
 
查询apk路径
查询所有第三方安装apk
查看所有安装的apk
 
 
命令详解:
C:\Users\Administrator>adb shell pm
usage: pm path [--user USER_ID] PACKAGE
       pm dump PACKAGE
       pm install [-lrtsfd] [-i PACKAGE] [--user USER_ID] [PATH]
       pm install-create [-lrtsfdp] [-i PACKAGE] [-S BYTES]
               [--install-location 0/1/2]
               [--force-uuid internal|UUID]
       pm install-write [-S BYTES] SESSION_ID SPLIT_NAME [PATH]
       pm install-commit SESSION_ID
       pm install-abandon SESSION_ID
       pm uninstall [-k] [--user USER_ID] PACKAGE
       pm set-installer PACKAGE INSTALLER
       pm move-package PACKAGE [internal|UUID]
       pm move-primary-storage [internal|UUID]
       pm clear [--user USER_ID] PACKAGE
       pm enable [--user USER_ID] PACKAGE_OR_COMPONENT
       pm disable [--user USER_ID] PACKAGE_OR_COMPONENT
       pm disable-user [--user USER_ID] PACKAGE_OR_COMPONENT
       pm disable-until-used [--user USER_ID] PACKAGE_OR_COMPONENT
       pm default-state [--user USER_ID] PACKAGE_OR_COMPONENT
       pm hide [--user USER_ID] PACKAGE_OR_COMPONENT
       pm unhide [--user USER_ID] PACKAGE_OR_COMPONENT
       pm grant [--user USER_ID] PACKAGE PERMISSION
       pm revoke [--user USER_ID] PACKAGE PERMISSION
       pm reset-permissions
       pm set-app-link [--user USER_ID] PACKAGE {always|ask|never|undefined}
       pm get-app-link [--user USER_ID] PACKAGE
       pm set-install-location [0/auto] [1/internal] [2/external]
       pm get-install-location
       pm set-permission-enforced PERMISSION [true|false]
       pm trim-caches DESIRED_FREE_SPACE [internal|UUID]
       pm create-user [--profileOf USER_ID] [--managed] [--restricted] [--epheme
ral] [--guest] USER_NAME
       pm remove-user USER_ID
       pm get-max-users
 
NOTE: 'pm list' commands have moved! Run 'adb shell cmd package'
  to display the new commands.
 
pm path: print the path to the .apk of the given PACKAGE.
 
pm dump: print system state associated with the given PACKAGE.
 
pm install: install a single legacy package
pm install-create: create an install session
    -l: forward lock application
    -r: replace existing application
    -t: allow test packages
    -i: specify the installer package name
    -s: install application on sdcard
    -f: install application on internal flash
    -d: allow version code downgrade (debuggable packages only)
    -p: partial application install
    -g: grant all runtime permissions
    -S: size in bytes of entire session
 
pm install-write: write a package into existing session; path may
  be '-' to read from stdin
    -S: size in bytes of package, required for stdin
 
pm install-commit: perform install of fully staged session
pm install-abandon: abandon session
 
pm set-installer: set installer package name
 
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, disable-until-used, default-state:
  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 apps. The permissions must be declared as used in the app's
    manifest, be runtime permissions (protection level dangerous),
    and the app targeting SDK greater than Lollipop MR1.
 
pm reset-permissions: revert all runtime permissions to their default state.
 
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
 
pm trim-caches: trim cache files to reach the given free space.
 
pm create-user: create a new user with the given USER_NAME,
  printing the new user identifier of the user.
 
pm remove-user: remove the user with the given USER_IDENTIFIER,
  deleting all data associated with that user
 
adb shell dumpsys 命令
adb shell dumpsys meminfo com.lianjia.beike 查看内存使用情况
adb shell dumpsys activity activities com.lianjia.beike 查看tesk信息
adb shell dumpsys cpuinfo 查看cpu信息
adb shell dumpsys diskstats 查看硬盘信息
adb shell dumpsys package com.xx.xx 查看包信息
 
查看当前窗体的apk的包名
adb shell dumpsys window
 
常用dumpsys:
指令
说明
备注
细分参数
activity
输出app组件相关信息
还可以用细分参数获得单项内容, 下同. 例如adb shell dumpsys activity activities来获取activity task/back stack信息.
activites, service, providers, intents, broadcasts, processes
alarm
输出当前系统的alarm信息
/
/
cpuinfo
输出当前的CPU使用情况
/
/
diskstats
输出当前的磁盘使用状态
/
/
batterystats
电池使用信息
/
/
package
package相关信息, 相当于pm功能的集合
输出诸如libs, features, packages等信息
/
meminfo
输出每个App的内存使用和系统内存状态
可以指定包名, 例如adb shell dumpsys meminfo com.anly.githubapp
/
window
输出当前窗口相关信息
/
policy, animator, tokens, windows
adb shell dumpsys gfxinfo com.xx.xx  查看gpu渲染信息
 
 
 
 
adb 命令
查看设备列表
 
C:\Users\Administrator>adb
Android Debug Bridge version 1.0.36
Revision 302830efc153-android
 
-a                            - directs adb to listen on all interfaces for a connection
-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 <specific device>          - directs command to the device or emulator with the given
                                 serial number or qualifier. 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.
-H                            - Name of adb server host (default: localhost)
-P                            - Port of adb server (default: 5037)
devices [-l]                  - list all connected devices
                                 ('-l' will also list device qualifiers)
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 files/dirs to device
  adb pull [-a] <remote>... <local>
                               - copy files/dirs from device
                                 (-a preserves file timestamp and mode)
  adb sync [ <directory> ]     - copy host->device only if changed
                                 (-l means list but don't copy)
  adb shell [-e escape] [-n] [-Tt] [-x] [command]
                               - run remote shell command (interactive shell if no command given)
                                 (-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 <command>            - run emulator console command
  adb logcat [ <filter-spec> ] - View device log
  adb forward --list           - list all forward socket connections.
                                 the format is a list of lines with the following format:
                                    <serial> " " <local> " " <remote> "\n"
  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 forward --no-rebind <local> <remote>   - same as 'adb forward <local> <remote>' but fails  if <local> is already forwarded
  adb forward --remove <local> - 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 <remote> <local> - reverse socket connections
                                 reverse specs are one of:
                                   tcp:<port>
                                   localabstract:<unix domain socket name>
                                   localreserved:<unix domain socket name>
                                   localfilesystem:<unix domain socket name>
  adb reverse --no-rebind <remote> <local>
                               - same as 'adb reverse <remote> <local>' but fails
                                 if <remote> is already reversed.
  adb reverse --remove <remote>
                               - 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] <file>
                               - 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))
                                 (-g: grant all runtime permissions)
  adb install-multiple [-lrtsdpg] <file...>
                               - 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] <package> - remove this app package from the device
                                 ('-k' means keep the data and cache directories)
  adb bugreport [<path>]       - return all information from the device that should be included in a zipped bug report.
                                 If <path> is a file, the bug report will be saved as that file.
                                 If <path> is a directory, the bug report will be saved in that directory with the name provided by the device.
                                 If <path> 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 outputon stdout.
  adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-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.)
                                 (-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)
                                 (<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 disable-verity           - disable dm-verity checking on USERDEBUG builds
  adb enable-verity            - re-enable dm-verity checking on USERDEBUG builds
  adb keygen <file>            - generate adb public/private key. The private key is stored in <file>,
                                 and the public key is stored in <file>.pub. Any existing files
                                 are overwritten.
  adb help                     - show this help message
  adb version                  - show version num
 
scripting:
  adb wait-for[-<transport>]-<state>
                               - wait for device to be in the given state:
                                 device, recovery, sideload, or bootloader
                                 Transport is: usb, local or any [default=any]
  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 get-devpath              - prints: <device-path>
  adb remount                  - remounts the /system, /vendor (if present) and /oem (if present) partitions on the device read-write
  adb reboot [bootloader|recovery]
                               - reboots the device, optionally into the bootloader or recovery program.
  adb reboot sideload          - reboots the device into the sideload mode in recovery program (adb root required).
  adb reboot sideload-auto-reboot
                               - reboots into the sideload mode, then reboots automatically after the sideload regardless of the result.
  adb sideload <file>          - sideloads the given package
  adb root                     - restarts the adbd daemon with root permissions
  adb unroot                   - restarts the adbd daemon without 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, /system, /vendor (if present), /oem (if present) and /data partitions will be updated.
 
  - If it is "system", "vendor", "oem" or "data", only the corresponding partition    is updated.
 
internal debugging:
  adb reconnect                  Kick current connection from host side and make it reconnect.
  adb reconnect device           Kick current connection from device side and make it reconnect.
environment 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.
 
 
实战:
安装一个apk,并启动它的闪屏(闪屏activity需要是exported=true)
查看app内存使用情况
 
 
相关问题:
adb install 和 adb shell pm install 的区别
adb install 是在远程主机上运行的,会上传apk 到手机上,然后安装
adb shell pm install 是运行的手机上的
底层adb 是对shell pm的封装

通过命令启动一个activity(am pm 命令)的更多相关文章

  1. WORKDIR 指定工作目录 每一个 RUN 都是启动一个容器、执行命令、然后提交存储层文件变更

    WORKDIR 指定工作目录 格式为 WORKDIR <工作目录路径>. 使用 WORKDIR 指令可以来指定工作目录(或者称为当前目录),以后各层的当前目录就被改为指定的目录,如该目录不 ...

  2. android技巧(一):如何方便知晓当前Activity?如何管理应用中的Activity?如何最佳的启动一个Activity?

    1.如何方便知晓当前Activity? 可以不看代码根据当前界面就知道界面所在Activity的写法: 建立BaseActivity,继承自Activity,在BaseActivity的OnCreat ...

  3. 【Android Developers Training】 15. 启动一个Activity

    注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...

  4. Android学习路线(十二)Activity生命周期——启动一个Activity

    DEMO下载地址:http://download.csdn.net/detail/sweetvvck/7728735 不像其他的编程模式那样应用是通过main()函数启动的.Android系统通过调用 ...

  5. Android 启动一个Activity的几种方式

    启动一个Activity的几种方式在Android中我们可以通过下面两种方式来启动一个新的Activity,注意这里是怎么启动,而非启动模式!分为显示启动和隐式启动! 1.显式启动,通过包名来启动,写 ...

  6. Appium+python自动化(三十五)- 命令启动appium之 appium服务命令行参数(超详解)

    简介 前边介绍的都是通过按钮点击启动按钮来启动appium服务,有的小伙伴或者童鞋们乍一听可能不信,或者会问如何通过命令行启动appium服务呢?且听宏哥一一道来. 一睹为快 其实相当的简单,不看不知 ...

  7. 【安卓面试题】在一个Activity启动另一个Activity和在Service中启动一个Activity有什么区别

    在Activity中可以直接使用Intent启动另一个Activity 显式Intent intent = new Intent(context, activity.class) 隐式 Intent ...

  8. 启动一个Activity的几种方式

    在Android中我们可以通过下面两种方式来启动一个新的Activity,注意这里是怎么启动,而非 启动模式!!分为显示启动和隐式启动! 1. 显式启动:通过包名来启动,写法如下: ①最常见的: st ...

  9. 隐式意图启动一个Activity

    隐式意图是通过指定一组动作或者属性实现,主要用于跨应用使用. 1.创建一个意图对象 Intent intent = new Intent(); 2.设置意图过滤器 intent.setAction(& ...

随机推荐

  1. 一个很大的文件,存放了10G个整数的乱序数列,如何用程序找出中位数。

    一.梳理审题 一.看清题目: 注意这个题目的量词,这个文件中有10G个整数,而不是这个文件占了10G的内存空间. 二.一些疑问: 在计算机中我们讲的G.M等都是存储容量的概念,但是一般都会在会面加上B ...

  2. 2016-ccf-data-mining-competition 搜狗用户画像构建

    想法1:   分成147(3*7*7)类, 后来觉得这样效果不好,后来看了看竞赛要求的也是分别预测,分别评分,而不是一次就把3类的标签都给出   所有后来我们改进了当时的想法,决定对年龄,性别,学历进 ...

  3. Android 创建SQLite数据库(一)

    Android内置了轻量级的数据库SQLite,这里将自己理解作个记录,方便自己复习. 一.首先,创建SQLite数据库比较常见的方式是通过Android提供的SQLiteOpenHelper来实现, ...

  4. HDU1059 二进制拆分优化多重背包

    /*问你能不能将给出的资源平分成两半,那么我们就以一半为背包,运行多重背包模版 但是注意了,由于个数过大,直接运行会超时,所以要用二进制拆分每种的个数*/ #include<stdio.h> ...

  5. [置顶] SNMP协议详解<三>

    在上篇文章中,说到了SNMPv3主要在安全性方面进行了增强,采用USM(基于用户的安全模型)和VACM(基于视图的访问控制模型)技术.下面我们就主要讲解SNMPv3的报文格式以及基于USM的认证和加密 ...

  6. SQL学习笔记二之MySQL的数据库操作

    阅读目录 一 系统数据库 二 创建数据库 三 数据库相关操作 一 系统数据库 information_schema: 虚拟库,不占用磁盘空间,存储的是数据库启动后的一些参数,如用户表信息.列信息.权限 ...

  7. PHP设计模式_注册树模式

    通过注册树模式可以更加简单快捷的获取对象,在某个地方实例化了一个对象,可以将这个对象“保存”起来(放入可以全局使用的数组里),用的时候只需要提供 保存对象的时候 的那个标识即可,解决全局共享和交换对象 ...

  8. Example解析

    本文总结自:https://github.com/abel533/Mapper/wiki/6.example,旨在提供一些基本概念上的解释 Example类用于条件查询,以代替冗长的"sel ...

  9. angular6开发不完全笔记(一) -- ng-cli

    新建项目 请在终端/控制台窗口中运行 ng -v 命令. 确定您已安装@angular/cli if没有执行 npm install -g @angular/cli 全局安装 Angular CLI. ...

  10. CodeForces - 55D Beautiful numbers(数位DP+Hash)题解

    题意:美丽数定义:一个正数能被所有位数整除.求给出一个范围,回答这个范围内的美丽数. 思路:一个数能被所有位数整除,换句话说就是一个数能整除所有位数的LCM,所以问题就转化为一个数能否被所有位数的LC ...