使用 adb shell am start 命令启动 activity 时 -n 的用途是什么

What is the use of -n while starting activity using adb shell am start command

我们可以使用以下 adb shell 命令启动 activity。

adb shell am start -n <PackageName>/<ActivityName>

但是有些应用上面的命令不起作用,我们需要从上面的命令中删除“-n”选项。点赞关注

adb shell am start <PackageName>/<ActivityName>

“-n”选项有什么用?为什么有时我们无法使用“-n”选项启动应用程序?

简答:none.

因为根据 Android ADB Command Line Documentation activity 经理没有选项 -n。所以一开始就不需要那个选项。

根据Specification for intent arguments

-n component

Specify the component name with package name prefix to create an explicit intent, such as com.example.app/.ExampleActivity.