问题
I'm trying to write a script which will launch the "app info" system dialog via adb for an app I'm testing.
I have done some investigation and came up with this command, which will launch "app info" but fails with a force close (NullPointerException in logcat):
adb shell am start -a android.intent.action.VIEW -n com.android.settings/.applications.InstalledAppDetails -es com.android.settings.ApplicationPkgName com.my.app -es pkg com.my.app
Seems that the package name isn't being properly passed.
What is the correct way to pass the package name parameter to the am
command in this case?
回答1:
adb shell am start -a android.settings.APPLICATION_DETAILS_SETTINGS -d package:<package-name>
回答2:
Also, check this: https://stackoverflow.com/a/4567928/4409113
adb shell am start -n com.package.name/com.package.name.ActivityName
http://developer.android.com/tools/help/shell.html#am
You can also issue an activity manager command directly from adb without entering a remote shell.
For example:
adb shell am start -a android.intent.action.VIEW
Seems like, start -a
is a good way.
来源:https://stackoverflow.com/questions/18589910/android-launch-app-info-dialog-via-adb-shell-am