Difference between adb "install" command and "pm install" command?
Asked Answered
A

1

23

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
Audet answered 24/2, 2015 at 0:2 Comment(0)
R
37

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

Raynold answered 24/2, 2015 at 0:7 Comment(3)
Updated link: android.googlesource.com/platform/system/adb/+/refs/heads/…Adrianneadriano
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.Raynold
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).Septilateral

© 2022 - 2024 — McMap. All rights reserved.