Difference between adb "install" command and "pm install" command?

34,689

adb install is a command to run from a development host, which uploads a package somewhere temporary and then installs it.

pm install is a command to run locally on the device.

adb does indeed utilize the pm program on the device - see the source code at

https://android.googlesource.com/platform/system/core/+/kitkat-mr2.2-release/adb/commandline.c

Share:
34,689
hackjutsu
Author by

hackjutsu

I code therefore I am.

Updated on July 09, 2022

Comments

  • hackjutsu
    hackjutsu almost 2 years

    What's the difference between installing an app using the install command and using the package manager's pm install command? Do they do the exact same job? Does one command actually call the other in the back?

    adb install -r APK_FILE
    adb shell pm install APK_FILE
    
  • Randall Flagg
    Randall Flagg almost 4 years
  • Chris Stratton
    Chris Stratton almost 4 years
    The reason this points at a specific revision is that the way things are implemented tends to change between versions, and "head" is not a specific version and so not a stable link eg, what is a .c file today might be a .cpp file next time around, or whatever.
  • LarsH
    LarsH almost 3 years
    So given that adb does utilize the pm program on the device, does that mean it should take all the same command-line options? The behavior I'm seeing is different. For example, adb shell pm install (on Android 10 device) rejects options like --no-incremental and --wait with an error such as "Unknown option --no-incremental." Whereas adb install gives no such error (but maybe ignores those options).