3

This question may relate both to the Flutter framework itself and to the Android development generally - I don't have enough knowledge in either to find out.

My problem is in updating the demo version of the app I'm developing on my phone. Each time I install the release version of the application using flutter install command, it first uninstalls the existing one, resulting in loss of data.

Is it possible to preserve this data between installations, without resorting to data backup through adb?

galenus
  • 2,087
  • 16
  • 24
  • 1
    Have you tried [Install over existing Android app on device using adb?](https://stackoverflow.com/q/39842874/295004) with the release version of the apk? – Morrison Chang Nov 18 '18 at 10:07
  • @MorrisonChang I haven't, but I will now, thanks for suggestion. – galenus Nov 18 '18 at 13:29
  • @MorrisonChang that worked, please add your suggestion as an answer so I could mark it as accepted one. Thanks again! – galenus Jan 14 '19 at 21:15

1 Answers1

4

As Flutter uses the Android SDK, all of the Android tools are available via the command line.

The Android command line tool adb is used to push and pull data and apks.

Replacing an existing app as if it were an update is a necessary part of testing (i.e. data schema changes, database upgrades) so to upgrade use:

$ adb install -r /path/to/myapp.apk

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

Morrison Chang
  • 11,691
  • 3
  • 41
  • 77