With a PC connection and adb, I can install packages by running

adb install foobar.apk

There is also an option to downgrade a package to an earlier version and keep data (as long the app itself did not introduce any incompatibilities in the later version):

adb install -r -d foobar.apk

Is there an equivalent local command which I could run from a terminal session (or any other way to downgrade without a PC connection)?


The local pm command can do this. You need the following things:

  • A terminal app. (adb shell will also work, but then you might just as well use adb install).
  • A way to get root permission on the command line (usually su)
  • A copy of the APK on the device, e.g. by downloading it using a web browser.

Open the terminal app, then run:

pm install -r -d /sdcard/download/foobar.apk

Command line options are the same as for adb install: -r will replace existing packages, -d will downgrade if necessary.

  • adb shell doesn't need root access which is a big step for majority of the users. So you can't say them equivalent, but both are commandline solutions. Btw there are workarounds to run adb shell on device. Oct 9 '19 at 17:54
  • pm install is equivalent in that it installs APKs and is capable of downgrading, just like adb install. It is true, though, that pm requires root while adb install doesn’t. adb shell just gets you a command line, which is the same thing that the terminal app does; neither requires root per se. Or did you mean adb install? If you have a way to run adb install on the device itself, without requiring a PC connection, feel free to post this as an answer.
    – user149408
    Oct 17 '19 at 13:50
  • adb install executes adb shell pm install at back end, so they are essentially the same thing. Point is to connect adb server to adbd, then you may execute any command adb XYZ. See this: android.stackexchange.com/a/216474/218526 Oct 18 '19 at 0:54
  • @IrfanLatif why not make this another answer? Both pm and local adb do the trick, each coming with their own prerequisites. Which of these two is easier depends mostly on your local device configuration.
    – user149408
    Oct 22 '19 at 11:07
  • It's already answered many times in different questions. You may consider updating your answer. Oct 22 '19 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.