21

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
hackjutsu
  • 8,336
  • 13
  • 47
  • 87

1 Answers1

35

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

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117
  • Updated link: https://android.googlesource.com/platform/system/adb/+/refs/heads/master/commandline.cpp – Randall Flagg Sep 26 '20 at 23:45
  • 1
    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. – Chris Stratton Sep 26 '20 at 23:51
  • 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). – LarsH Aug 04 '21 at 13:50