1

i just want to have more clarity in what adb does by default .

when i run adb install for an apk that is already installed the cmd only shows :

Performing Streamed Install
Success

it does not specify if it is skipping the install or if overwriting.

and is there a verbose option for adb for it to be more clear of what is doing ?

2
  • It's never skipped silently. It overwrites if new APK's signature matches with and the version is equal or greater than the preinstalled one. Otherwise it throws error stating clearly the reason, which might be also other than the signature and version e.g. an app component contradicting with some preinstalled app. Jun 7, 2021 at 7:25
  • when it overwrites does it make it silently or it tells that its being overwritten?
    – bigubr
    Jun 7, 2021 at 8:47

1 Answer 1

3

General restrictions

You can only install an APK file that has the same package name as an already installed app if the following two requirements are met.

  1. The installed app and the APK file you want to install must be signed by the same developer key, otherwise you will get the rror INSTALL_FAILED_UPDATE_INCOMPATIBLE Package <packagename> signatures do not match previously installed version; ignoring!
  2. There is a app down-grade protection which means the versionCode (specified in AndroidManifest.xml) of the app to be installed have to be equals or greater than those of the already installed app. Otherwise you will get the error INSTALL_FAILED_VERSION_DOWNGRADE. This can only be bypassed for apps that have the debuggable flag set. Then you can add the adb option -d to bypass this restriction.

The last factor is the Android version. The behavior of adb install seems to be dependent on the Android version.

Android 10+

On Android 10 and 11 I was able to observer that Android does not care if an app is already installed or not.

Therefore as long as the new APK file signed with the same developer key you can simply execute adb install to install an updated app version.

Android 9 and lower

On Android 9 and before however by default the simple adb install command will just fail with the error INSTALL_FAILED_ALREADY_EXISTS if an app with the same package name is already installed. The specified APK file will not be installed in such a case.

Only if you use adb install -r an existing app that has the same package name as the one you want to install can be replaced but there are two restrictions.

3
  • i used adb install only without the " -r" and they didnt failed just said success. the apk i used is the same one. i installed the apps and when runned the install again they all said only success.
    – bigubr
    Jun 7, 2021 at 8:45
  • @bigubr Installing the same APK again may be a special case. Or the behavior also depends on the Android version.
    – Robert
    Jun 7, 2021 at 8:59
  • @bigubr The Android version is really important, since Android 10 you don't need to specify the -r option anymore.
    – Robert
    Jun 7, 2021 at 11:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .