您的位置:首页 > 移动开发 > Android开发

Android通过adb启动应用

2015-04-23 15:02 253 查看
在Android中,除了从界面上启动程序之外,还可以从命令行启动程序,使用的是命令行工具am.

usage: am [subcommand] [options]
start an Activity:
am start [-D]  -D: enable debugging
send a broadcast Intent:
am broadcast
start an Instrumentation:
am instrument [flags]
-r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT)
-e : set argument to
-p : write profiling data to
-w: wait for instrumentation to finish before returning
start profiling:
am profile start
stop profiling:
am profile stop
specifications include these flags:
[-a ] [-d ] [-t ]
[-c [-c ] ...]
[-e|--es ...]
[--ez ...]
[-e|--ei ...]
[-n ] [-f ] []


启动的方法为

$ adb shell
$ am start -n {包(package)名}/{包名}.{活动(activity)名称}


例如,启动包名为com.example.wdy.classifier的应用,启动命令如下:

am start -n com.example.wdy.classifier/com.example.wdy.classifier.MainActivity
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐