writofmandamus writofmandamus - 2 months ago 24
Android Question

How to install over existing Android app on device using adb?

During development, I use something like

$ adb -s 192.168.1.77:5555 uninstall com.myApp.app

$ adb -s 192.168.1.77:5555 install /path/to/android-debug.apk


to uninstall the existing app, then push and install the updated app to my device. However, this seems to erase my existing data associated with the app so that each time I run the updated app I need to input the new data again. However, simply running the install command gives:

[ 10%] /data/local/tmp/android-debug.apk
[100%] /data/local/tmp/android-debug.apk
pkg: /data/local/tmp/android-debug.apk
Failure [INSTALL_FAILED_ALREADY_EXISTS]


With iOS you can simply install your updated app over the existing app on the device.

What is the equivalent for Android preferably using
adb
?

Answer

from adb --help

adb install [-lrtsdg] <file>
        - push this package file to the device and install it
         (-l: forward lock application)
         (-r: replace existing application)
         (-t: allow test packages)
         (-s: install application on sdcard)
         (-d: allow version code downgrade (debuggable packages only))
         (-g: grant all runtime permissions)

Therefore you can just add -r option

$ adb -s 192.168.1.77:5555 install -r /path/to/android-debug.apk