Why does adb install <same-packagename-always-release> fail?

an00b picture an00b · Jan 29, 2012 · Viewed 29.1k times · Source

I know that adb install will not replace an existing package if it's of a different build type (i.e. debug vs. release).

Eclipse also successfully replaces the debug apks whenever I run a debug session.

But when I attempt adb install for replacing an existing release apk with another release apk (same package name!), I get a failure message:

adb install myapp-release.apk 
    pkg: /data/local/tmp/myapp-release.apk
Failure [INSTALL_FAILED_ALREADY_EXISTS]
745 KB/s (34310 bytes in 0.044s)

Wasn't that supposed to work? What am I missing?

Answer

alex.zherdev picture alex.zherdev · Jan 29, 2012

I suppose if the app is already installed, you need to supply the -r key:

adb install -r myapp-release.apk

From the adb help:

'-r' means reinstall the app, keeping its data