转自:http://blog.sina.com.cn/s/blog_51335a0001017ux5.html
 

adb shell am instrument [options] <COMPONENT>

作用:启动对instrument实例的监视。

参数[options]:

-e <key> <value> // -e选项需要放在-w选项之前

作用:提供了以键值对形式存在的测试选项。Android中提供了多种键值对,具体参见下表。
举例:-e class com.android.phone.FIncomingCallTests#testRejectCall

-r

作用:以原始形式输出测试结果。该选项通常是在性能测试时与-e perf true一起使用。

参数 <COMPONENT>:

-w <test_package_name>/<runner_class> //<test_package_name>和<runner_class>在测试工程的AndroidManifest.xml中查找

作用:保持adb shell打开直至测试完成
举例:-w com.android.phone.tests/com.android.phone.runners.FunctionalTestRunner

<key> <value>参考表

Key Value Description
package <Java_package_name> The fully-qualified Java package name for one of the packages in the test application. Any test case class that uses this package name is executed. Notice that this is not anAndroid package name; a test package has a single Android package name but may have several Java packages within it.
class <class_name> The fully-qualified Java class name for one of the test case classes. Only this test case class is executed.
<class_name>#method name A fully-qualified test case class name, and one of its methods. Only this method is executed. Note the hash mark (#) between the class name and the method name.
func true Runs all test classes that extend InstrumentationTestCase.
unit true Runs all test classes that do not extend either InstrumentationTestCase orPerformanceTestCase.
size [small | medium |large] Runs a test method annotated by size. The annotations are @SmallTest,@MediumTest, and @LargeTest.
perf true Runs all test classes that implement PerformanceTestCase. When you use this option, also specify the -r flag for am instrument, so that the output is kept in raw format and not re-formatted as test results.
debug true Runs tests in debug mode.
log true Loads and logs all specified tests, but does not run them. The test information appears in STDOUT. Use this to verify combinations of other filters and test specifications.
emma true Runs an EMMA code coverage analysis and writes the output to/data//coverage.ec on the device. To override the file location, use thecoverageFile key that is described in the following entry.

Note: This option requires an EMMA-instrumented build of the test application, which you can generate with the coverage target.

coverageFile <filename>

Overrides the default location of the EMMA coverage file on the device. Specify this value as a path and filename in UNIX format. The default filename is described in the entry for the emma key

adb shell am start [options] <INTENT>

作用:启动一个activity

举例:adb shell am start -a com.lt.test.action.SECOND

举例:adb shell am start -n com.lt.test/.MyActivity

说明:[options]与<INTENT>参见 http://developer.android.com/tools/help/adb.html#am

adb shell am startservice [options] <INTENT>

作用:启动一个service

举例:adb shell am startservice -a com.lt.test.action.ONESERVICE
举例:adb shell am startservice -n com.lt.test/.MyService

adb shell am force-stop <PACKAGE>
作用:强制关闭一个应用程序

举例:adb shell am force-stop com.lt.test

adb shell am broadcast [options] <INTENT>

作用:发送一个广播
举例:adb shell am broadcast -a "action_finish" (发送一个广播去关闭一个activity)
举例:adb shell am broadcast -a android.intent.action.MASTER_CLEAR(恢复出厂设置的方法,会清除内存所有内容)

举例:adb shell am broadcast -n com.lt.test/.MyBroadcast

adb shell pm list packages [options] <INTENT>

作用:列举出所有包含<INTENT>的package

举例:adb shell pm list packages com.lt

说明:[options]与<INTENT>参见 http://developer.android.com/tools/help/adb.html#pm

参考链接:

http://developer.android.com/tools/help/adb.html

Android_adb shell am/pm使用的更多相关文章

  1. adb shell am broadcast 手动发送广播及adb shell am/pm其他命令

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/zi_zhe/article/details/72229201 在命令行可用adb shell am ...

  2. adb shell am pm 用法

    Using activity manager (am) Within an adb shell, you can issue commands with the activity manager (a ...

  3. adb shell am pm

    adb shell am instrument [options] <COMPONENT> 作用:启动对instrument实例的监视. 参数[options]: -e <key&g ...

  4. adb shell am/pm 常用命令详解与使用

    一.adb shell am 使用此命令可以从cmd控制台启动 activity, services:发送 broadcast等等 1.am start <packageName/.classN ...

  5. adb shell am命令

    adb shell am命令是在cmd命令行可以通过命令来启动Activity,Boradcast,Service等,更多使用可以参考下面附件. 比如在cmd串口我们发送广播,广播action是&qu ...

  6. 【Android】-- adb shell 命令探索

    ADB是什么,做android开发的没有不知道的. window下执行cmd,输入adb help就会打印adb都可以做的事情,包含 adb push ..adb pull .. adb device ...

  7. Android自动化学习笔记:获取APK包名的几种方法

    ---------------------------------------------------------------------------------------------------- ...

  8. 常用的adb命令

    在平时的工作中,会经常用到adb命令,在这里稍微整理了一下. 一.概要 1.什么是adb? adb全称为Android Debug Bridge,就是起到调试桥的作用.顾名思义,adb就是一个debu ...

  9. WebApiContrib

    https://github.com/WebApiContrib ASP.NET Web API and Protocol Buffers Protocol Buffers are a super e ...

随机推荐

  1. HttpClient教程

    2.1.持久连接 两个主机建立连接的过程是很复杂的一个过程,涉及到多个数据包的交换,并且也很耗时间.Http连接需要的三次握手开销很大,这一开销对于比较小的http消息来说更大.但是如果我们直接使用已 ...

  2. js校验表单后提交表单的三种方法总结

    第一种: 复制代码 代码如下: <script type="text/javascript">         function check(form) { if(fo ...

  3. VS2010+OpenCV2.4.6永久性配置方法

    1. 配置OpenCV环境变量 计算机->(右键)属性,出现如图1所示界面 单击“高级系统设置”,选中高级(标签)出现如图2所示界面 单击右下方的“环境变量”,弹出如图3所示界面,注意这里最好用 ...

  4. 一排cell就第一个cell要点两次才响应,其他的cell都点一下就响应

    一开始还以为是控件的问题,后来查了下百度,没办法谷歌不能用,结果有人说方法写错了 -(void)tableView:(UITableView *)tableView didSelectRowAtInd ...

  5. Jenkins 搭建U3D自动发布 Android

    工具 [u3d相关的PostProcessBuildPlayer,PerformBuild.cs] 1.Jenkins 开源包  Java -jar jenkins.war,参考链接 http://w ...

  6. Windows 下安装项目管理工具 Redmine 1.1.2

    1.InstantRails-2.0-win 下载地址  https://rubyforge.org/frs/?group_id=904 2.redmine1.1.2 下载地址  http://www ...

  7. 连接ssql语句

  8. Oracle 11g r2 x64 中文乱码解决方案

    1.检查服务器编码: 执行SQL语法: select * from v$nls_parameters; 2.设置本地客户端编码: 进入 我的电脑,属性,高级,环境变量,添加2项:LANG=zh_CN. ...

  9. [Angularjs]ng-file-upload上传文件

    写在前面 最近在弄文档库的H5版,就查找了下相关的上传组件,发现了ng-upload的东东,推荐给大家. 系列文章 [Angularjs]ng-select和ng-options [Angularjs ...

  10. Swift Tour 随笔总结 (1)

    let Constant var Variable let implicitInteger = 70 let implicitDouble = 70.0 let explicitDouble: Dou ...