转自: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. java内存模型及GC原理

    java内存模型 sun官方网站:sun java 虚拟机模型 JVM内存模型中分两大块,一块是 NEW Generation, 另一块是Old Generation. 在New Generation ...

  2. Unity-Tween

    1.GoKit 免费开源 AssetStore:https://www.assetstore.unity3d.com/en/#!/content/3663 下载地址:https://github.co ...

  3. CSS transition 过渡 详解

    transition 过渡 IE10.Firefox.Chrome.Opera 支持 transition 属性. Safari 需要前缀 -webkit-. Chrome 25 以及更早版本需要前缀 ...

  4. linux安全加固(2)

    目录:1.BIOS2.SSH安全3.禁用telnet4.禁用代码编译5.ProFTP6.TCPwrappers7.创建一个SU组8.root通知9.history安全10.欢迎信息11.禁用所有特殊账 ...

  5. c语言 函数传输传递的三种方式(值、指针、引用)

    本文摘自<彻底搞定c指针> 一.三道考题开讲之前,我先请你做三道题目.(嘿嘿,得先把你的头脑搞昏才行……唉呀,谁扔我鸡蛋?)考题一,程序代码如下:void Exchg1(int x, in ...

  6. 用80x86汇编语言编程:1 + 2 + 3 + 4 + 5 + …… + n,和小于100,在屏幕上显示次数和结果。

    ;============================================== ;1+...+n < 100 ;--------------------------------- ...

  7. [Angularjs]angular ng-repeat与js特效加载先后导致的问题

    写在前面 最近在项目中遇到这样的一个前端的bug,在ng-repeat中绑定的图片,有一个晃动的特效,在手机端浏览的时候,图片有时候会正常展示,有时就展示不出来.当时猜测是因为angularjs与特效 ...

  8. Jquery validate插件使用方法详解

    html: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Reg.aspx.c ...

  9. Power Network(网络流最大流 & dinic算法 + 优化)

    Power Network Time Limit: 2000MS   Memory Limit: 32768K Total Submissions: 24019   Accepted: 12540 D ...

  10. cocos进阶教程(2)多分辨率支持策略和原理

    cocos2d-x3.0API常用接口 Director::getInstance()->getOpenGLView()->setDesignResolutionSize() //设计分辨 ...