如何用adb命令启动你的Android程序

我们都知道用"adb install filename.apk"命令可以安装一个android程序,那你知道在安装后如何启动你的程序吗?

试试下面的命令吧。

  
  
adb shell am start - a android.intent.action.MAIN - c android.intent.category.LAUNCHER - n breakan.test / break an.test.TestActivity

或简单一些。

  
  
adb shell am start - n breakan.test / breakan.test.TestActivity

其中"breakan.test/breakan.test.TestActivity"中的"breakan.test"是程序的包名,"TestActivity"是程序Activity类的类名。

我们来看下adb shell am命令的帮助。

  
  
usage: am [subcommand] [options] start an Activity: am start [ - D] [ - W] < INTENT > - D: enable debugging - W: wait for launch to complete start a Service: am startservice < INTENT > send a broadcast Intent: am broadcast < INTENT > start an Instrumentation: am instrument [flags] < COMPONENT > - r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT) - e < NAME > < VALUE > : set argument < NAME > to < VALUE > - p < FILE > : write profiling data to < FILE > - w: wait for instrumentation to finish before returning start profiling: am profile < PROCESS > start < FILE > stop profiling: am profile < PROCESS > stop < INTENT > specifications include these flags: [ - a < ACTION > ] [ - d < DATA_URI > ] [ - t < MIME_TYPE > ] [ - c < CATEGORY > [ - c < CATEGORY > ] ...] [ - e |-- es < EXTRA_KEY > < EXTRA_STRING_VALUE > ...] [ -- esn < EXTRA_KEY > ...] [ -- ez < EXTRA_KEY > < EXTRA_BOOLEAN_VALUE > ...] [ - e |-- ei < EXTRA_KEY > < EXTRA_INT_VALUE > ...] [ - n < COMPONENT > ] [ - f < FLAGS > ] [ -- grant - read - uri - permission] [ -- grant - write - uri - permission] [ -- debug - log - resolution] [ -- activity - brought - to - front] [ -- activity - clear - top] [ -- activity - clear - when - task - reset] [ -- activity - exclude - from - recents] [ -- activity - launched - from - history] [ -- activity - multiple - task] [ -- activity - no - animation] [ -- activity - no - history] [ -- activity - no - user - action] [ -- activity - previous - is - top] [ -- activity - reorder - to - front] [ -- activity - reset - task - if - needed] [ -- activity - single - top] [ -- receiver - registered - only] [ -- receiver - replace - pending] [ < URI > ]

  • 0
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值