Android_adb shell am/pm使用
2013-12-06 17:00
225 查看
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>参考表
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
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 an Android 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 InstrumentationTestCaseor PerformanceTestCase. |
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 -rflag 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 inSTDOUT. 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.econ the device. To override the file location, use the coverageFilekey 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 coveragetarget. |
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 theemmakey |
作用:启动一个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中LocationManager的简单使用,获取当前位置[转
- Android 打包 apk
- 在Android中调用图片、视频、音频、录音、拍照
- android实现屏幕全屏
- 【Android设备管理】 利用DevicePolicyManager执行屏幕锁定
- android Launcher——数据加载与变更
- Android提高十八篇之自定义Menu(TabMenu)
- Android Animation学习笔记
- Android实战技巧:为从右向左语言定义复杂字串
- 在Ubuntu上为Android系统内置Java应用程序测试Application Frameworks层的硬件服务
- Android开发视频教学_读书笔记
- android Fragments详解四:管理fragment
- android webkit 打开debug调试信息
- Android软件开发之 自定义别样Toast
- android中SAX解析xml
- android 短信和电话拦截
- Android设备功能之传感器教程篇
- Android平台开发-Android keypad map-Android按键识别及映射过程
- android导入系统源码
- android一种较为复杂的布局