android am 命令总结
来源:互联网 发布:ab post json 编辑:程序博客网 时间:2024/06/10 14:29
# Script to start "am" on the device, which has a very rudimentary# shell.#base=/systemexport CLASSPATH=$base/framework/am.jarexec app_process $base/bin com.android.commands.am.Am "$@"
Activity
specified by<INTENT>
.See the Specification for <INTENT> arguments.
Options are:
-D
: Enable debugging.-W
: Wait for launch to complete.--start-profiler <FILE>
: Start profiler and send results to<FILE>
.-P <FILE>
: Like--start-profiler
, but profiling stops when the 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.--opengl-trace
: Enable tracing of OpenGL functions.--user <USER_ID> | current
: Specify which user to run as; if not specified, then run as the current user.
Service
specified by<INTENT>
.See the Specification for <INTENT> arguments.
Options are:
--user <USER_ID> | current
: Specify which user to run as; if not specified, then run as the current user.
<PACKAGE>
(the app's package name).kill [options] <PACKAGE>Kill all processes associated with <PACKAGE>
(the app's package name). This command kills only processes that are safe to kill and that will not impact the user experience.Options are:
--user <USER_ID> | all | current
: Specify user whose processes to kill; all users if not specified.
Kill all background processes.
broadcast [options] <INTENT> Issue a broadcast intent.See the Specification for <INTENT> arguments.
Options are:
[--user <USER_ID> | all | current]
: Specify which user to send to; if not specified then send to all users.
Instrumentation
instance. Typically the target<COMPONENT>
is the form<TEST_PACKAGE>/<RUNNER_CLASS>
.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.--no-window-animation
: Turn off window animations while running.--user <USER_ID> | current
: Specify which user instrumentation runs in; current user if not specified.
<PROCESS>
, write results to <FILE>
.profile stop <PROCESS>Stop profiler on <PROCESS>
.dumpheap [options] <PROCESS> <FILE>Dump the heap of <PROCESS>
, write to <FILE>
.Options are:
--user [<USER_ID>|current]
: When supplying a process name, specify user of process to dump; uses current user if not specified.-n
: Dump native heap instead of managed heap.
<PACKAGE>
to debug.Options are:
-w
: Wait for debugger when application starts.--persistent
: Retain this value.
set-debug-app
.monitor [options] Start monitoring for crashes or ANRs.Options are:
--gdb
: Start gdbserv on the given port at crash/ANR.
<PACKAGE>
.display-size [reset|<WxH>] Override emulator/device display size. This command is helpful for testing your app across different screen sizes by mimicking a small screen resolution using a device with a large screen, and vice versa.Example:am display-size 1280x800
Example:am display-density 480
See the Specification for <INTENT> arguments.
to-intent-uri <INTENT> Print the given intent specification as anintent:
URI.See the Specification for <INTENT> arguments.
启动的方法为一个activity
# am start -n 包名/包名.活动(activity)名称启动照相机:
# am start -n com.android.camera/com.android.camera.Camera
启动浏览器
# am start -n com.android.browser/com.android.browser.BrowserActivity
启动浏览器并上网:
#am start -a android.intent.action.VIEW -d http://www.google.cn/
打电话 :
#am start -a android.intent.action.CALL -d tel:10086
profile
#am profile 进程号 start profile_result.txt
#am profile 进程号 stop
启动一个service
#am startservice service的intent
启动instrument测试(界面上是进dev tools -->instrument选择)
看看浏览器测试工程的xml文件
<application> <uses-library android:name="android.test.runner" /></application> <!-- This declares that this app uses the instrumentation test runner targeting the package of com.android.email. To run the tests use the command: "adb shell am instrument -w com.android.browser.tests/android.test.InstrumentationTestRunner" --> <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.android.browser" android:label="Tests for Browser."/> <instrumentation android:name="com.android.browser.BrowserLaunchPerformance" android:targetPackage="com.android.browser" android:label="Browser Launch Performance"> </instrumentation>
将当前浏览器加到单元测试中
# am instrument -w com.android.Browser/android.test.InstrumentationTestRunner
运行某个TestCase:
# am instrument -w -e class com.android.BrowserTest.PopularUrlsTest com.android.Browser/android.test.InstrumentationTestRunner
运行一个TestCase中的某个功能:
adb shell am instrument -w -e class com.android.BrowserTest.PopularUrlsTest#testStability com.android.Browser/android.test.InstrumentationTestRunner
同时测试多个TestCase:
#am instrument -w -e class com.android.BrowserTest.PopularUrlsTest,TestWebViewClient.java com.android.Browser/android.test.InstrumentationTestRunner
public class ApiDemosRunner extends InstrumentationTestRunner{ @Override public TestSuite getAllTests(){ Log.i(”ApiDemosRunner”, “ApiDemosRunner::getAllTests()”); return new TestSuiteBuilder(ApiDemosRunner.class).includeAllPackagesUnderHere().build(); } @Override public ClassLoader getLoader(){ return ApiDemosRunner.class.getClassLoader(); }}
- android am 命令总结
- android am命令
- android am命令
- android am命令
- android adb am命令
- android am命令
- android adb am命令
- Android am命令
- Android命令am简介
- android adb am命令
- android am pm命令
- Android am命令
- android am pm命令
- android am pm命令
- ---------------android am pm命令
- android am命令
- Android am & pm 命令
- 浅谈android am命令
- Python学习笔记整理(六)Python中的字典(含字典嵌套内容)
- Openfire 的安装和配置
- Java中配置环境变量
- Localytics:AngularJS代替Backbone 代码减少一半
- Java_覆写、重载区别
- android am 命令总结
- 查看linux机器是32位还是64位
- Android基于XMPP Smack Openfire开发IM【一】登录openfire服务器
- 程序员修炼之道 你的知识资产【转】
- GROUP BY,WHERE,HAVING之间的区别和用法
- SMI HANDLER EXECUTION ENVIROMENT
- CoreText 使用教程:以创建一个简单的杂志应用为例
- Android基于XMPP Smack Openfire开发IM 【二】获取好友列表
- 云计算领域10大最重要的科技公司