How do I open an app using ADB when I know the app's package name but not the component name of the main activity?

有帮助吗?

解决方案

If you only know the package name of the app you want to launch but not the name of it's main activity, use this command

adb shell monkey -p com.android.chrome -c android.intent.category.LAUNCHER 1

Where com.android.chrome is the package name of the app you want to open.

The monkey command is used for making random touch and keyboard inputs on the connected device. The command above specifies that only one event can be issued, which is the open activity event. The -c option is to specify that only activities with the category android.intent.category.LAUNCHER can be opened, which is the action that is used as an entry point for the app.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top