Android通过adb启动应用

来源:互联网 发布:实时电脑远程软件 编辑:程序博客网 时间:2024/05/17 18:46

在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
0 0
原创粉丝点击