writofmandamus writofmandamus - 1 year ago 159
Android Question

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

During development, I use something like

$ adb -s uninstall com.myApp.app

$ adb -s 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

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

What is the equivalent for Android preferably using

Answer Source

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 install -r /path/to/android-debug.apk
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download