Debugging/Deploying app without uninstall RRS feed

  • Question

  • User88526 posted

    I need to test database migration processes on-device/in the simulator, but the default behavior of Xamarin in Visual Studio is to completely uninstall the previous version of the app before it installs the new one. Is there a way to set up the deployment process so that it will just install the new version of the app as an upgrade instead acting like a clean install?

    Thursday, April 23, 2015 12:52 PM

All replies

  • User209 posted

    Go to Tools>Options>Xamarin and set Preserve application data/cache on device between deploys

    Thursday, April 23, 2015 2:07 PM
  • User88526 posted

    Sweet, I knew there had to be a way. I'll try this tonight. Thanks!

    Thursday, April 23, 2015 2:11 PM
  • User88526 posted

    @Cheesebaron I don't think this worked. I checked that setting but still get this when I debug:

    1>Build succeeded. 1>Waiting for device.. 1>Detecting installed packages 1>Detecting installed packages... 1> 1>Removing previous version of application 1>Removing previous version of application... 1> 1>Installing application on device 1>Copying application to device...

    I don't want it to do the 'Removing' portion.

    Friday, April 24, 2015 12:16 AM
  • User88526 posted

    Even turning Fast Deployment on doesn't do that.

    Friday, April 24, 2015 1:22 AM
  • User88526 posted

    Ya, definitely not working. I even factory reset my development device to no avail. Upgrading to 3.9.547 to see if anything is fixed there.

    Friday, April 24, 2015 2:46 AM
  • User88526 posted

    Still nothing on the latest version of Xamarin...unless I'm misunderstanding what it means to 'Preserve' this data...

    Friday, April 24, 2015 3:25 AM
  • User88526 posted

    OK, so it looks like Xamarin for Visual Studio doesn't honor this setting, but Xamarin Studio does. I guess I'll have to use XStudio for the purpose of debugging...

    Friday, April 24, 2015 3:36 AM
  • User88526 posted

    and now it doesn't deploy the app during debugging at all......................

    Xamarin Studio

    Detecting installed packages

    Waiting for packaging to complete

    Terminating running application

    Deployment completed

    Visual Studio

    2>Build started. 2>Build succeeded. 2>Waiting for device.. 2>Detecting installed packages 2>Detecting installed packages... 2>

    Friday, April 24, 2015 3:54 AM
  • User88526 posted

    I give up. This feature appears to be completely broken across both VS and XStudio. Even if the version number of the app I'm debugging/deploying is greater than the one currently installed it will sometimes completely remove it before installing the new one. Here is the scenario I'm trying to test:

    1. Install current version from Google Play, login, do some stuff.
    2. Debug the latest code on the device, leaving its shared settings/data/cache in place (this built debug binary is signed with the exact same certificate as Production)

    No matter what I try it will not stop doing a Remove/Install. Even Xamarin Studio is so confused that it seems to think that the Google Play app version matches the version I'm trying to debug, so doesn't deploy the new version at all.

    @Cheesebaron any ideas?

    Friday, April 24, 2015 4:21 AM
  • User209 posted

    Dunno, works fine when I debug with my devices.

    Friday, April 24, 2015 6:23 AM
  • User88526 posted

    @Cheesebaron if this feature is working as expected it should skip the "Removing previous version of application" portion of the deploy process, correct?

    Friday, April 24, 2015 10:52 AM
  • User7479 posted

    @MattBaker.7976 Just confirming this feature does not work correctly for me either. I have a Nexus 5 and a Samsung Note 8, both of which lose the current version of the application when deploying. This does not happen when using GenyMotion but then I can't test bluetooth features. I wish someone could offer a solution.

    Thursday, May 14, 2015 12:17 AM
  • User129386 posted

    Sorry for resurrecting an old thread, but I found out something about this.

    If I'm using a rooted android phone, this does not work for me. If I'm using a non-rooted phone, this does work for me.

    If any of your test devices are rooted, this may have something to do with it.

    Wednesday, December 2, 2015 12:26 AM
  • User2422 posted

    Another note FOI: My device is not rooted and visual studio 2017 seems to be wiping things out on each Debug run to a real device LG G5!

    Tuesday, April 18, 2017 2:30 PM
  • User96360 posted

    Same problem here with rooted Honor Note 8 The app's files are deleted with every debug session.

    Thursday, May 11, 2017 10:02 PM
  • User210933 posted

    Same problem here.

    Tuesday, August 8, 2017 3:56 AM
  • User250676 posted

    This actually just started happening to me after a Xamarin update. This used to work fine with my (non-rooted) Sony Xperia, but now data is definitely removed before every debugging session. In addion, deploys take forever.

    Data is not removed with the VS Emulator for Android though. Clueless what is going on here.

    Wednesday, August 23, 2017 2:13 PM
  • User342498 posted

    @ElteHupkes said: This actually just started happening to me after a Xamarin update. This used to work fine with my (non-rooted) Sony Xperia, but now data is definitely removed before every debugging session. In addion, deploys take forever.

    Data is not removed with the VS Emulator for Android though. Clueless what is going on here.

    Any fixes for this? I have the same problem.

    Monday, September 18, 2017 11:49 AM
  • User250676 posted

    @IvanVelichkovski Unfortunately I haven't found any yet.

    Wednesday, September 20, 2017 8:06 AM
  • User289352 posted

    It is working with iOS simulator.

    Thursday, September 28, 2017 10:06 AM
  • User63735 posted

    Broken for both android and iOS for me, im using VSFM(Visual studio for mac). Visual Studio Community 2017 for Mac Version 7.3 (build 799) Xamarin.Android Version: Xamarin.iOS Version: (Visual Studio Community) Hash: 6857dfcc Branch: xcode9.2 Build date: 2017-12-04 21:20:41-0500

    Wednesday, February 7, 2018 1:53 AM
  • User63735 posted

    Im happy to announce updating to: Visual Studio Community 2017 for Mac Version 7.3.3 (build 12)

    Has since fixed this issue.

    Wednesday, February 7, 2018 4:13 AM
  • User380822 posted

    Same problem here, non-rooted Google Pixel 2, and Visual Studio 2017 15.6.7 for Windows with Xamarin

    This used to work fine a year or two ago, but then suddenly it started wiping my app every time I make a small code change and deploy. Makes Xamarin almost completely useless :/

    A blank new Xamarin project writing to Preferences doesn't seem to have this problem, so it's something different with my actual, more complicated project... but none of the suggestions here work.

    I've somewhat narrowed down the issue. In my complex project, if I edit any of the layout .axml files and deploy, it uninstalls and reinstalls. But if I just edit the .cs files in my project, it'll deploy fine without wiping my data. But in the blank new project, editing layout files works fine.

    Wednesday, December 19, 2018 5:36 PM
  • User380822 posted

    Update: VS 15.9.4 for Windows seems to have fixed the problem so far! I was previously on 15.6. I hope this stays fixed!

    Wednesday, January 9, 2019 3:10 AM
  • User378384 posted

    update 15.9.5, issue remains

    Friday, January 18, 2019 8:07 AM
  • User381696 posted

    VS 7.7.3 for Mac has the same problem. Debugging on real device wiping all of its data.

    Issue reported, hope this is the last issue we are facing for Xamarin app maintaining, after this no more XAMARIN.

    Wednesday, January 23, 2019 8:21 PM
  • User260753 posted

    @_andyng could you post the link for the issue reported? It's embarrassing this still happens.

    Tuesday, February 19, 2019 3:57 PM
  • User382196 posted

    same error here trying to debug without wiping data.

    agree with @_andyng, simple things starting up but later it's getting difficult with XAMARIN

    unchecking the deploy, no luck : needs to be deployed before it can be started. Verify the project is selected to be deployed in the Solution Configuration Manager.

    Monday, March 4, 2019 3:52 PM
  • User72117 posted

    Yes it no worky

    Wednesday, April 17, 2019 10:32 PM
  • User389239 posted

    Hi everyone,

    I had experienced the same issue with Android device and I might have, possibly an answer, at least partial to what was happening.

    • Issue - I was testing the migrations as well and encountered the fact, that application seemed to be uninstalled and reinstalled after code changes. This caused shared prefs to be wiped out as well as other data.
    • Resolution - I noticed, that this was exactly happening when the Backup (using Google Drive) was set to ON. As soon as I set it to OFF - voila - debugging started working as expected, without un-installation and data loss.

    The setting is in Settings->System->Backup

    The Backup setting may also be an explanation of why different developers, have inconsistent experience with un-installation during the debug and VS does not obey the aforementioned preserve setting.

    Friday, February 28, 2020 6:55 PM
  • User379427 posted

    Just chiming in to let you know that the solution proposed by Hobbitenok2010 still works on Android devices :) and the general issue still persists.

    Wednesday, January 20, 2021 4:42 PM