[Android] Use the adb command line tool combined with pm to list the application names and package names of installed applications on Android devices

To list the application names and package names of installed applications on an Android device, you can use the adb command line tool combined with the pm (PackageManager) command.

First, make sure you have installed the Android SDK and add the adb tool to your system's environment variables.

Then, open a terminal or command line window, connect your Android device, and enter the following command:

adb shell pm list packages -f

The above command will list the package names and application names of all installed applications. The format of each line is: package:com.example.app=/data/app/com.example.app-1.apk, where com.example.appis the package name and /data/app/com.example.app-1.apkis the application installation path.

If you only need to list package names and application names, you can use the following command:

adb shell pm list packages | sed 's/package://'

The above command will list only the package name, not the app name.

Note that if your device has multiple users, you may need to --userspecify the user using the parameter, for example:

adb shell pm list packages --user 0

in the above command --user 0represents the user with user ID 0 (usually the owner user of the device).

With the above adb command, you can list the application names and package names of installed applications on your Android device.

Guess you like

Origin blog.csdn.net/gao511147456/article/details/132604130