locked
Newest version of code not always deployed when debugging from Xamarin Studio RRS feed

  • Question

  • User119398 posted

    I have found recently that if I build an run from within Xamarin Studio, the newest version of my code doesn't always get deployed. The code does get rebuilt, and I see the message about deploying to device, but the code that runs isn't always my newest (I have verified this).

    The application is a Xamarin.Forms application.

    So far, I've only seen this happen on Android. It happens on the Xamarin Android Player and actual devices.

    If I rebuild all, or manually delete the app from the device, the newest code deploys.

    The date/time of the device and my PC are correct, so it makes me think it's not a timestamp issue.

    Has anybody seen this?

    Any suggestions on how to fix it?

    Thursday, July 9, 2015 7:57 PM

All replies

  • User48032 posted

    Check the Android project's build configuration. Make sure that Fast assembly deployment is unchecked. (Project > Options > Build > Android Build > General tab). Let me know if this solves your problem!

    Thursday, July 9, 2015 8:04 PM
  • User2148 posted

    @TimF Yesterday I have not the same thing. I have deployed to a POS with a integrated printer. I pressed a button to print some strings but I have seen "old" string go out from the printer. I have deleted manually "bin" and "obj" directory and all works fine.

    Thursday, July 9, 2015 8:53 PM
  • User119398 posted

    Thanks @LoriLalonde !

    I tried unchecking Fast Assembly Deployment, but now my app crashes when it tries to run. A stacktrace is being written to my data directory, but unfortunately the handset I'm using isn't rooted, and adb isn't working properly for me, so I can't pull the stacktrace.

    Any ideas?

    Thursday, July 9, 2015 10:06 PM
  • User48032 posted

    @TimF, try completely uninstalling the application from the device. Clean the solution and debug. If it is still crashing, try setting the Target Android Version and Minimum Android Version explicitly, rather than using the Automatic - use target framework version setting, and see if that solves it. If not, the only other thing I can ask is to copy the output generated in the Application Output window in Xamarin Studio to a text file and post it here.

    Friday, July 10, 2015 2:14 PM
  • User119398 posted

    Thanks! That seems to have helped.

    How come having Fast Assembly Deployment checked causes this problem?

    Friday, July 10, 2015 7:25 PM
  • User119398 posted

    It seems this didn't fix the problem after all. I'm seeing it again, even with Fast Assembly Deployment unchecked.

    Saturday, July 11, 2015 7:19 PM
  • User119398 posted

    Has anybody else encountered this problem? It happens pretty much all the time now. Only options are to uninstall the application or do a rebuild every time, which is really slowing down my development.

    Wednesday, July 15, 2015 6:11 PM
  • User149505 posted

    I have the same problem, Fast assembly deployment did not help. I continuously uninstall package, rebuild/clean application until it updates... completely frustrating.

    Monday, August 17, 2015 8:04 PM
  • User119398 posted

    @GreggJohns.8260 I have found a workaround, although it's not ideal: I've found that if you touch any file in the platform dependent solution it should build properly. For example, I'm doing a Xamarin.Forms project, and if the build system doesn't always notice changes in my PCL. But if I touch my Android project's MainActivity.cs, a proper build gets made.

    Hope that helps

    Friday, August 21, 2015 7:49 PM
  • User105140 posted

    @TimF Really? I think I had the same issue when altering MainActivity.cs, but will try next time this occurs and post if the workaround holds for me.

    Monday, August 24, 2015 3:03 PM
  • User119398 posted

    Another thing to check is to make sure the time on your development machine and device are in sync. I've had some problems with my Xamarin Android Player device with time zones, auto time update, etc.

    Monday, August 24, 2015 3:39 PM
  • User105140 posted

    @TimF Just ran into the same problem as before, tried modifying MainActivity with no resolve. Times on development machine and device seem to be in sync.

    Wednesday, August 26, 2015 4:21 PM
  • User90863 posted

    Xamarin needs to fix this problem. I can not produce any build without having to rebuild each time. How am i supposed to test my Android apps if I have to rebuild each time and then deploy. Unacceptable.

    Tuesday, December 15, 2015 12:13 AM
  • User105140 posted

    Any news on a fix for this problem? At one time it was suggested to modify main activity to resolve the issue. However, this workaround does not seem to be effective. I am still encountering this issue! Xamarin contacted me basically saying they had never heard of this issue, despite this thread having been established in July, they contacted me regarding sample projects which I cannot provide. Completely insane!

    Friday, February 26, 2016 8:21 PM
  • User187646 posted

    I'm having the same problem with iOS. Every time I deploy to device, I have to clean the solution first. I am on the Alpha build though (6.0).

    Saturday, March 12, 2016 7:27 PM
  • User3188 posted

    Same for us. Only on android. Every time I press Run, if i didn't touch a file, the app will never start, and visual studio will never stop. it's waiting on something, but I don't know what. There is no log in the %appdata%xamarin/logs/ or in the visual studio output folder (even with verbose). I'm trying to repro the problem with a new project, but it doesn't happen.

    Friday, April 15, 2016 6:20 PM
  • User223974 posted

    Same for us (Android). We have a PCL + Android...

    Please Xamarin: You really need to invest more time in answering requests in this Forum!! About 70-80% of all "results" i found for my researches for the many problems we have with xamarin are unanswered by xamarin - no reactions at all - you really need to invest more manpower in supporting your xamarin community!!!

    Thursday, May 26, 2016 10:04 AM
  • User228124 posted

    I have the same problem... I tried every advice in this topic, not of them works :(

    Does anybody has a solution ?

    I can't imagine that every xamarin forms developer works like that, it's really painful. We can't be sure that our last changes are deployed, it is really time consuming.

    Wednesday, June 8, 2016 12:16 PM
  • User182905 posted

    Had the same problem with iOS. Made changes to Xamarin.Forms PCL (with Grial UI.Toolkit), but no changes on the simulator. Had to delete the app from the simulator before I saw any changes. Very annoying.

    Monday, June 13, 2016 12:16 PM
  • User16346 posted

    I am having this problem now with Android and nothing seems to fix it using Xamarin Studio on OSX. I've been using Xamarin since 2012 and the experience recently seems to be getting worse not better. I'm at the position where going native is becoming so much more attractive. Any productivity I gain from using C# is lost with issues like this. This product should be mature enough that we are no longer having these sorts of issues. I don't mind the odd issue but this is consistent and I can't fix it.

    Monday, June 20, 2016 8:31 AM
  • User57571 posted

    I am having the same issues with Xamarin Studio 6, my teammates have Xamarin Studio 5 or using Visual Studio and they can build and debug w/o any problems, it seems that the configuration mapping are creating this types of problems, I can debug using Iphone Simulator but not with Android emulators or devices, using "Run with" option I can deploy to devices but I cannot debug, trying to change to alpha channel only make the things worse, here are some pics:

    Any ideas?

    Tuesday, June 21, 2016 4:53 PM
  • User211105 posted

    as I was trying to add some stuffs for my ToggleButton, I noticed that I could press on it, but it wouldn't do the stuffs I told it to do in code...

    with a little Google and experimenting, I made a final confirmation by changing button.Text = string.Format("{0} clicks!", count++); into button.Text = string.Format("{0} clicks hey!", count++);, but it still displayed the "1 clicks!" text, when I run it...

    I tried various methods, including deleting bin and obj, de-checking Fast Deployment and Shared Runtime, enabling armeabi and armeabi-v7a (they was already enabled), granting permissions but none of them worked...

    I tried running on both Nexus 4 and 10, but it seems like it only accept changes from the layout and completly ignore any changes (but the default) done in the various Activities...

    Xamarin, you really need to step up your games and actually check the forum, seeing for how long this have been alive

    Monday, June 27, 2016 10:02 AM
  • User128835 posted

    I have same issue. Often it's happening with PCL projects (i working with MvvmCross) and, of course, it's working only on Xamarin Studio.

    Sometimes nothing can't help me, not clean, rebuild or delete app from simulator. Only closing and opening XS works for me.

    Tuesday, July 5, 2016 6:32 AM
  • User187715 posted

    Same issue here. Updated Xamarin and related stuff yesterday, and today my old code gets deployed everytime I run and debug to Xamarin player. I'm using Visual Studio 2015.

    Edit: a factory reset of the Xamarin Android Player Device seems to have fixed my issue. For now...

    Thursday, July 7, 2016 7:48 AM
  • User187715 posted

    Nope, that was a temporary solution. After building and deploying, the old code is running again. :(

    Thursday, July 7, 2016 2:48 PM
  • User245874 posted

    Hello everyone... i faced this issue today and here is what i did to solve it and run my tests in debug mode on android emulator: erase everything from Release/obj, Release/bin, Debug/bin, Debug/obj, and uninstall the application from the emulator... Now my recent changes back to appear on the android emulator everytime

    Friday, July 29, 2016 9:24 PM
  • User246359 posted

    The solution from AlexRod works for me - thank you!

    Tuesday, August 2, 2016 2:28 PM
  • User226261 posted

    No Way I had this headache from this afternoon … but @AlexRod solution was saved me. Just humble request as this is going to be mysterious problem lets give a like to the answers which solved this problem.

    Friday, August 5, 2016 5:14 AM
  • User248465 posted

    The solution from AlexRod works. I found that you don't need to erase Release/obj, Release/bin, Debug/bin, Debug/obj. Just uninstalling the app from device or emulator takes care of the problem.

    Tuesday, August 9, 2016 9:29 PM
  • User30819 posted

    I still have this problem with Android development from Visual Studio. What I've noticed is that if I change an xml or axml file and press "Deploy", then the app is removed from the app drawer and then readded (i.e. uninstalled + installed again). This always works. If I just change a code behind file, e.g. MainActivity.cs, the deployment is much faster but the app is NOT uninstalled/reinstalled and my changes are NOT applied. If I uninstall the app from the emulator and deploy again - then it works. If I change a xml or axml file and deploy - then it works.

    I've tried with and without the Tools => Options => Xamarin => "Preserve application data/cache on device between deploys".

    Any ideas on how to get this to work? It's fairly irritating since I often debug stuff that isn't wrong (it just isn't deployed correctly). Also - a full deploy is of course slower and thus more time consuming in the development process.

    Wednesday, August 17, 2016 2:30 PM
  • User197193 posted

    Just do a "clean solution" in Visual Studio. Then if you get the "System.IO.FileNotFoundException", remove the xamarin nuget package and install again.

    Saturday, September 10, 2016 4:01 PM
  • User222247 posted

    AlexRod's solution (without cleaning up obj folders) works, saved my week. Thanks! [Really, really annoying. Bugs [[features]] like these make life "interesting", like hitting your finger with a hammer to forget you have a headache....] Anyway, again, thanks.

    Thursday, October 20, 2016 6:42 AM
  • User247597 posted

    I cleaned bin folders manually (for visual studio) and droid debug working...

    Wednesday, October 26, 2016 3:38 PM
  • User241491 posted

    I'm getting this all the time too, when I do notice it happens uninstalling the app first always fixes it.

    Saturday, November 5, 2016 6:17 PM
  • User574 posted

    For those of you having this problem can you try something for us.

    Go to Xamarin Studio: Help > Open Log Directory and attach the AndroidTools.<DATE>.log file. That should contain some of the information we need to diagnose this issue.

    Alternatively you try deploying from the command line.

    Make the changes in the app as normal then from the command line run

    msbuild project.csproj /t:Install /v:d > build.log

    If you get the same problem, i.e the app is NOT updated with the changes. attach the build log so we can take a look at what is happening. If possible make a note of which file was changed.

    For background, when FastDev is enabled (which you should use when debugging) the app on the device will only be updated if resources have changed. If you only change C# code the assemblies will be moved to a special directory which in the installed app picks up.

    Thursday, December 8, 2016 3:25 PM
  • User289927 posted

    Found out a solution Build=> Configuration Manager... => Active solution configuration=> set it to Release

    Tuesday, January 10, 2017 3:25 PM
  • User291173 posted

    Why would set this to Release solves the problem ?

    Tuesday, January 17, 2017 8:03 PM
  • User293759 posted

    I had the same issue. Uninstalling the application from the emulator and re-built it. It worked!

    Monday, January 23, 2017 1:45 PM
  • User180712 posted

    So I've been having this issue, or at least I thought this was the issue, for a long while. I'm running fast deployment and shared runtimes during development. I'm on Visual Studio 2015 with the current latest stable release of Xamarin.

    The symptom is that if I change a code file and redeploy/run the app without debugging, I will not see my latest change. If I redeploy/run once more, the changes will appear. This is repeatable every time.

    I've been looking at the build process trying to figure out if there is something wrong there. It turns out though that it has nothing to do with the build. The code is properly built and the result is deployed into the .../.__override__ path on my emulator. The problem is that the changes aren't picked up during the app restart on the emulator. If I kill the app through the task switcher and restart it, the changes will appear.

    As an addition to this post, this is how I solved my problem for now. In the project properties, under build events, I added a post-build event like this: adb shell am force-stop my.app.package.name

    This works if you have adb in your path and only one device connected. I suppose you "should" be able to pick up the path to adb through properties defined in the build, and perhaps even the device you are deploying to as well as your package name. But this will have to do for me right now.

    Wednesday, February 1, 2017 9:01 AM
  • User21936 posted

    @FredrikSvensson ,

    Thanks for posting your findings and that is interesting. I tried to reproduce the issue with both a Xam.Android and Xam.Forms PCL solution, but could not. Code changes were picked up whether in the Android platform app project or in the Forms PCL project, XAML or C# code.

    Could you provide some concrete steps to reproduce so I can try to replicate the issue and see what can be done to mitigate this issue?

    Also it would be helpful if you could provide the info requested by Dean Ellis above (https://forums.xamarin.com/discussion/comment/238926/#Comment_238926)

    Saturday, February 4, 2017 1:47 AM
  • User219163 posted

    I'm currently running on this problem. But for now, I didn't found a solution.

    What changed since it was working is that I was developping a Windows Phone version of my app and came back on the Android App to fix something.

    I don't have steps to reproduce but tell me if I can help Jon.

    Sunday, February 5, 2017 11:45 PM
  • User299980 posted

    I think I found out why this problem is happening. The reason is that in .Droid projects /bin and /obj folders remain busy by some processes even after deployment on the testing device is finished. And if one does a new build after short period of time either happens an error or and old version of build is used. If wait few minutes after the first build, then, during a new deployment everything works well and all functionalities are updated. I am just a very fresh beginner, so sorry if my comment is not relevant or not correct

    Tuesday, February 14, 2017 11:54 AM
  • User21936 posted

    @Slava87

    Thanks for those observations. It might still help to get the info Dean Ellis asked for in this post on this thread.

    Tuesday, February 14, 2017 9:29 PM
  • User296452 posted

    I have the same issue nothing so far have resolved my issue. I have followed all of the above mentioned trick. Please help it started to frustrate me. Thanks

    Wednesday, February 15, 2017 2:10 PM
  • User127707 posted

    I have this too. Its so annoying. It's been happening for at least a month now when archiving in Release mode.

    Attached the log Dean Ellis asked for. I had to change the extension to .txt because these forums don't seem to accept .log files.

    Thursday, February 16, 2017 7:44 AM
  • User574 posted

    Thanks for the data.

    If you look at the log there are allot of "SkipCopyFile" comments. If the file you modified has a SkipCopyFile next to it then it seems adb thinks that file did not change.

    The next step is to get the full diagnostic build output for the project. Along with the name of the assembly that was changed. That way I can take a good look at the logs. Alternatively you can do the whole thing from the command line

    msbuild /t:SignAndroidPackage /v:d > build.log msbuild /t:Install /v:d > install.log

    That will give us all the data we need. Note we do need to know which assembly/file was changed otherwise it makes it hard to see why things are not working.

    Tuesday, February 28, 2017 10:03 AM
  • User93714 posted

    So I have this issue every now and then. Usually nuking bin and obj directories solves it. Today, that's not the case. And to make things even more strange, it's building the latest code on Phone A but building old code to Phone B. Very strange.

    Here is my procedure.

    -Remove app from Phone A -Clean entire solution -Nuke /bin and /obj directores -Deploy to Phone A, phone a is running old code...

    -Remove app from Phone B -Clean entire solution -Nuke /bin and /obj directores -Deploy to Phone B, phone a is running the latest code fine

    Here are my Android Tools and IDE logs:

    https://drive.google.com/open?id=0B5x7JEZ8aQihMTVrSm9FM0dWNzg

    Edit

    I was able to resolve this by doing the following in terminal: cd /Users/myName/Library/Developer/Xamarin/android-sdk-macosx adb uninstall com.mycompany.myappname

    Looks like the app wasn't really removed from my device despite me doing an uninstall. And when deploying from Xamarin, it wasn't overwriting it.

    Tuesday, March 21, 2017 11:36 PM
  • User93714 posted

    I was able to resolve this by doing the following in terminal:

    cd /Users/myName/Library/Developer/Xamarin/android-sdk-macosx adb uninstall com.companyname.appname

    This fully removes the application from the device. My issue was that the app was not getting removed from the device despite me uninstalling. And Xamarin's deploy was not overwriting the old code.

    Tuesday, March 21, 2017 11:56 PM
  • User42790 posted

    The problem still occurs Xamarin Studio 6.2 build 1829.

    Uninstalling is not always an option - it's normally my first point of uninstalling on the device. In my case I'm debugging a problem that occurs for people doing updates :-(

    Changes to resources are being detected and propagated to the app but old code was still being invoked.

    As you can see from the screenshot below, the runtime type of the object being created is different - it's an older version of the class. The visible effects on the Android device indicate that is indeed what is happening. Somehow, an old version of MainActivity is being invoked and creating the old object.

    Things tried which made no difference:

    • restart the device
    • deleting bin and obj folders,
    • delete the Library/Developer/Caches/XamarinStudio-6.0
    • turn off Fast Assembly Deployment
    • turn off Use Shared Mono Runtime
    • enable Generate one package per selected ABI

    Note that, after I suspected code changes were not being propagated, I renamed the class, its file and even refactored the code so that the work is done in a different method. The debugger as shown in the screenshot thinks it is iterating the new code but is creating an instance of the old object.

    Android Tools log attached

    Wednesday, March 22, 2017 3:45 AM
  • User42790 posted

    In my case I'm changing one tiny file that's linked into a small test program, so there are no separate DLLs being changed.

    Simple changes to the MainActivity.cs are being ignored - the code in the main fragment is not being propagated to the device.

    So I bit the bullet and uninstalled the application:

    • Built and ran the replacement version to ensure that when run as a clean install, the expected logic is invoked.
    • Uninstalled the replacement
    • Went back and built and ran the original app.
    • Stopped the original.
    • Used the Application manager on the device to do a Force Stop of the original
    • Rebuilt the replacement.

    Now, trying to run the replacement, get a very interesting error:

    ``` Detecting existing process

    am start -n "io.realm.testmigratefrom771droid/md50576fb6928abddee0e8c9d637bb1d306.MainActivity" Starting: Intent { cmp=io.realm.testmigratefrom771droid/md50576fb6928abddee0e8c9d637bb1d306.MainActivity } Error type 3 Error: Activity class {io.realm.testmigratefrom77_1droid/md50576fb6928abddee0e8c9d637bb1d306.MainActivity} does not exist. ```

    Wednesday, March 22, 2017 9:23 AM
  • User313265 posted

    The problem is solved for me after doing the steps in the link Stackoverflow answered by Yoruba.

    Friday, March 31, 2017 10:51 AM
  • User325221 posted

    FWIW...I encountered a similar issue and a found a different work-around. (I am using VS2017 Community 15.2 Release 26430.6 + Xamarin 4.5.0.443 + Xamarin.Android SDK 7.3.0.13.) In my case, I can never deploy my Android app more than once to the same Android Virtual Device in succession. The second and all subsequent attempts to the same virtual device will hang on the deployment. The emulator starts, and my app is installed in the emulated device, but the app won't start, and VS just hangs at the deployment step. To work around this, I created a second Android Virtual Device that is essentially identical to the first. As long as I keep toggling between the two virtual devices on every redeployment, the deployments succeed.

    Sunday, May 21, 2017 4:52 AM
  • User332050 posted

    [Really, really annoying. Bugs [[features]] like these make life "interesting", like hitting your finger with a hammer to forget you have a headache....] Anyway, again, thanks.

    LMAO

    Thursday, July 6, 2017 5:42 PM
  • User278825 posted

    hey guys any news?? @JGoldberger @DeanEllis

    Tuesday, July 11, 2017 12:58 AM
  • User346480 posted

    So, here is my experience:

    I moved my project from one pc to other, then I got the same issue like everyone. It seems to me that VS have problems to deal with moved projects some times. All issues was been fixed when I erased bin and obj from android and ios projects.

    Monday, September 18, 2017 12:16 PM
  • User224135 posted

    I think the leader of Xamarin team need to leave.

    Saturday, December 23, 2017 11:07 AM
  • User364056 posted

    Resolved! time sync, had resolved my issue. Me dugging in device.

    superuser.com/questions/1047359/cant-sync-windows-10-clock-to-the-internet

    Monday, December 25, 2017 12:01 PM
  • User339055 posted

    @DeanEllis - I'm getting this intermittently on the latest version of VS Enterprise (15.5.2) and Xamarin version 4.8.0.753. Uninstalling the app from the device and re-deploying seems to be the only work around at the moment.

    What VS logs do you need to diagnose the issue? From the Help > Xamarin > Open Logs directory, I can see four types of log file (xxx.Ide.log, xxx.XamarinLive.log, inspector-xxx.log and monodroid-xxx.log). - I'm guessing it's monodroid that you want. (See attached)

    Going back to one of your earlier comments:

    For background, when FastDev is enabled (which you should use when debugging) the app on the device will only be updated if resources have changed. If you only change C# code the assemblies will be moved to a special directory which in the installed app picks up.

    I had a look in the monodroid log file, and can see the following:

    MonoDroidLog: Information: 0: [D:NotifyPhase]:          Uploading files
    MonoDroidLog: Information: 0: [D:NotifySync]:           CopyFile C:\MyApp\MyApp.Droid.Service\obj\Debug\android\assets\MyApp.Service.dll /storage/sdcard/Android/data/com.microlise.MyApp.service/files/.__override__/MyApp.Service.dll 98304
    MonoDroidLog: Information: 0: [D:NotifySync]:           SkipCopyFile C:\MyApp\MyApp.Droid.Service\obj\Debug\android\assets\MyApp.App.dll /storage/sdcard/Android/data/com.microlise.MyApp.service/files/.__override__/MyApp.App.dll 49664
    MonoDroidLog: Information: 0: [D:NotifySync]:           SkipCopyFile C:\MyApp\MyApp.Droid.Service\obj\Debug\android\assets\MyApp.dll /storage/sdcard/Android/data/com.microlise.MyApp.service/files/.__override__/MyApp.dll 98816
    

    The MyApp.Service.dll is the main android project, MyApp.App.dll is a portable class library containing Xamarin Forms views and view models, and MyApp.dll is another portable class library, but only contains shared business logic. (Although it does have a ref to Xamarin.Forms)

    In this particular instance, I made changes to four files in the MyApp.App.dll project (two .xaml files, two .cs files), and made further changes to one .cs file in the MyApp.dll project. No changes were made to the android project. (MyApp.Service.dll)

    Friday, January 5, 2018 11:01 AM
  • User2794 posted

    Where's the proper place to file this issue? github or bugzilla?

    Sunday, January 7, 2018 5:35 PM
  • User21936 posted

    @knocte

    Depends on what exact product. When you get to the "Select product page" on bugzilla when filing a new bug, you will get redirected to Github if the product you select has moved to github issues.

    Monday, January 8, 2018 11:50 PM
  • User2794 posted

    Well, my question is, what product should I file it in? Not sure if VS4Mac or Xamarin.Android.

    Tuesday, January 9, 2018 2:08 AM
  • User21936 posted

    File it against the IDE, but in bugzilla it is still Xamarin Studio.

    For component, select General.

    Wednesday, January 10, 2018 12:50 AM
  • User339055 posted

    @JGoldberger @knocte Was this issue logged in bugzilla? I can't find it.

    Thursday, February 1, 2018 11:59 AM
  • User141012 posted

    I still face with this issues, but on Visual Studio 2017 (Windows) I do not want to clean up everything (bin, obj, etc. ) uninstall my app each time when I need debug, all this increase time of development in 2 times. I wonder whether anybody from Xamarin team at least tried to fix the issue. Now it seem that Microsoft doesn't care which problems Xamarin developers face with.

    Friday, June 29, 2018 7:55 AM
  • User217165 posted

    recently i'm having the issue only in one of my projects which working fine before but still don't know how to fix the issue i have to rebuild the all project every time to get the changes

    Sunday, July 8, 2018 11:02 AM
  • User217165 posted

    ok i was getting this message when try to rebuild : 'Could not resolve this reference. Could not locate the assembly ' what i did clean then delete the reference from android project of the shared or .net standard project then rebuild after rebuild i receive new message that can't find the reference of the main project i add the reference again then the issue gone now i can see my changes without rebuild

    Sunday, July 8, 2018 12:46 PM
  • User190593 posted

    I was facing this issue when working on a Xamarin.Android project with PCL in Visual Studio 2017 and running the app on my connected Samsung Galaxy S5. I noticed that sometimes when I changed some code in a Xamarin.Android class and deployed the changes, they wouldn't reflect on the device the first time and I'd need to deploy them again to have them reflect. Other times it would work normally.

    I found that if I edited a .cs file and immediately ran CTRL+F5 (without saving the changes) the changes wouldn't be reflected on that deploy (even though deploying should also save and rebuild changes). If I saved the changes (CTRL + S) then ran CTRL + F5 the changes would be immediately reflected normally. This might not be what most of you are facing but it might help someone.

    Thursday, July 26, 2018 9:43 AM
  • User190593 posted

    Actually I take that back. Saving the file manually seems to not work anymore (at least when I set the phone's "Automatic date and time" back to "checked"). - I had previously removed the phone's Automatic time setting in an effort to investigate the problem. It could be a combination of both the manual save as well as manual time setting that will work. I will report back if it does.

    Thursday, July 26, 2018 10:21 AM
  • User190593 posted

    Manually saving the edited file still doesn't work even though I had tested it multiple times before posting my first comment. @JGoldberger I have attached my logs. Would you be able to help?

    There are some SkipCopyFile commands but those are all for files that have not changed. The files that do change i.e. GulfHR.Android are copied so that's fine.

    What I noticed however is that on some runs/deploys those commands are not invoked at all. When comparing runs, I see that sometimes only a subset of commands are logged (like line 1070 - line 1076 were from 1 deploy) while other runs/deploys have longer logs (like line 1077 - line 1152 where from another deploy). Does that help/make sense?

    Thursday, July 26, 2018 11:23 AM
  • User190593 posted

    sorry here's the log file.

    Thursday, July 26, 2018 11:27 AM
  • User367180 posted

    Had this issue all day, oddly setting to "Release" fixed it but every time after I try to use debug and the old app shows. Very frustrating.

    Thursday, July 26, 2018 8:08 PM
  • User21936 posted

    @FadiHani @ClovyClov

    Can you both try turning off Fast Deployment and uninstalling the App from the device?

    Apparently fast deployment might not work on some devices according to https://docs.microsoft.com/en-us/xamarin/android/deploy-test/building-apps/build-process#fast-deployment

    Fast deployment is known to fail on devices which block adb from synchronizing to the directory /data/data/@PACKAGE_NAME@/files/.override.

    And there is this logged issue: https://developercommunity.visualstudio.com/content/problem/187614/disabling-the-android-fast-deployment-option-does.html

    Friday, August 3, 2018 7:38 PM
  • User293317 posted

    Hello,

    Apparently I have the same problem as everyone else here. I get the issue of some files not being updated during a redeploy. Rebuild, deleting obj/bin folders, uninstalling the app from the phone(testing on actual device, an Honor 8 Pro) does nothing. Weirdly, it's an issue only with one of the files which contains some common settings for my application - URLs of the Backend, as well as some Terms and Conditions checks. I can use the app normally if I deploy the app and clear all Application Data directly on the phone, but that means I cannot debug. It seems like the Cache of the app is being uploaded during every run of the app, and it is using an old version of the data for some reason. I have tried finding where this cache is being kept, but no success so far. It seems like this issue started appearing when I fiddled with the Retain Application Data option in Visual Studio 2017, but I do not know where it keeps that cache and how it redeploys with it. If someone could point me to where this cache is that might resolve my issue.

    Best regards

    Thursday, January 3, 2019 12:26 PM
  • User21936 posted

    @KonstantinSevery

    This sounds like a different issue than what was described as it is an issue with application data it would seem, and is only an issue with a specific file.

    What type of app is it that is having this issue, Xam.Android, Xam.iOS, or Xam.Forms, and if Xam.Forms, what platform is issue occurring on? What type of file is it? What is the build action of the file? How is the file used, i.e. how are you using and storing the info in the file? Can you share the file?

    It would also help to get the info requested by Dean Ellis in this post: https://forums.xamarin.com/discussion/comment/238926/#Comment_238926

    If you can't share the above publicly, you can open a free email support case so we can exchange files securely and privately. You can open a free Xamarin support case here: https://support.microsoft.com/en-us/getsupport?wf=0&tenant=classiccommercial&oaspworkflow=start_1.0.0.0&locale=en-us&supportregion=en-us&pesid=16068&forceorigin=esmc&ccsid=636645150473349054

    Thursday, January 3, 2019 7:11 PM
  • User293317 posted

    Hey, thanks for reaching out with these requests for information. Let me clarify on as many of those points as possible: The app I have is a Xamarin.Forms one, where the issue I'm experiencing is only on Android. The file that is causing me grief is an AppSettings.cs file, a regular C# class that uses the Xam.Plugin.Settings NuGet to save some data locally. The main property that is causing me grief is a RefreshToken that I set on the initial login in the app and it is , for some reason, loaded from an old version that validates against a wrong Authority URL(my user login logic is based on OpenId and IdentityServer4). As this is a regular C# class file, the BuildAction is C# Compiler. As noted above, the file is using the Xam.Plugin.Settings NuGet to save its data. My guess is that for some reason Visual Studio is keeping an old version of these settings and is for some reason restoring those on every deploy to the device. I have not tried reinstalling Visual Studio yet as I have not had the time - I have a workaround to run the app on Android(no debugging) and I can properly debug on iOS. The file is something like this:(omitting actual values)

    public class AppSettings : IAppSettings
        {
            private ISettings Settings => CrossSettings.Current;
    
    #if DEBUG
            public string ApiUrl => Settings.GetValueOrDefault(nameof(ApiUrl), "somelocalURL");
    
            public string Authority => Settings.GetValueOrDefault(nameof(Authority), "somelocalURL");
    
            public string AppCenterKey => Settings.GetValueOrDefault(nameof(AppCenterKey), "");
    #else
            public string ApiUrl => Settings.GetValueOrDefault(nameof(ApiUrl), "somedevurl");
    
            public string Authority => Settings.GetValueOrDefault(nameof(Authority), "somedevurl");
    
            public string AppCenterKey => Settings.GetValueOrDefault(nameof(AppCenterKey), "");
    #endif
    
            public string ClientId => Settings.GetValueOrDefault(nameof(ClientId), "SomeClientId");
    
            public string ClientSecret => Settings.GetValueOrDefault(nameof(ClientSecret), "SomeClientSecret");
    
            public string Scope => Settings.GetValueOrDefault(nameof(Scope), "somescopes");
    
            public string RedirectUri => Settings.GetValueOrDefault(nameof(RedirectUri), "somecallback");
    
            public string DbPath => Settings.GetValueOrDefault(nameof(DbPath), Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "somedb.db3"));
    
            public bool HasReadTermsAndConditions
            {
                get => Settings.GetValueOrDefault(nameof(HasReadTermsAndConditions), false);
                set => Settings.AddOrUpdateValue(nameof(HasReadTermsAndConditions), value);
            }
    
            public string RefreshToken
            {
                get => Settings.GetValueOrDefault(nameof(RefreshToken), string.Empty);
                set => Settings.AddOrUpdateValue(nameof(RefreshToken), value);
            }
        }
    
    Friday, January 4, 2019 1:37 PM
  • User21936 posted

    @KonstantinSevery

    Hmm, interesting. I suspect the issue is that the settings are maintained on the device. Are you making sure to run the code that sets the settings every time the app is launched, even if the setting has already been set during a previous run of the app?

    Visual Studio should not be saving any of these settings itself, but you might try turning off the Fast deployment option as that should reset the app settings on the device for each deploy. With Fast Deployment set, it may preserve the old settings. Not nearly 100% certain on the exact reason as I am not very familiar with how the plugin works behind the scenes, but it should be storing the settings on device in a location for application data, which should be preserved between deploys if the Fast Deployment option is set.

    Let me know if that helps.

    Friday, January 4, 2019 8:58 PM
  • User293317 posted

    @JGoldberger Hey, sorry for not answering for these few days. And, sadly, this does not fix my issue - I had already tried it before this. Fast Deployment is off, Visual Studio's "Preserve App Data during Debug" is also off, but the data is still preserved. I think it's Visual Studio doing something as I completely remove the app from the device before trying to deploy it again. My main issue is that the RefreshToken property should be preserved between app launches, but it's being preserved beyond that, like it's being loaded from somewhere on deploy. I have tried going through the files on my device trying to find any leftover data after the app has been uninstalled, but no luck so far. For all I know, everything has been removed.

    Monday, January 7, 2019 8:09 AM
  • User21936 posted

    OK, then it would help to get the build log and other info requested by Dean Ellis in this post: https://forums.xamarin.com/discussion/comment/238926/#Comment_238926

    The build log should show wha files are being compiled and which are being skipped, which will help us isolate if it is a problem with the changed file not getting recompiled or something other issue. Of course make a change to the file before building and collecting he build log.

    If you can't share the above publicly, you can open a free email support case so we can exchange files securely and privately. You can open a free Xamarin support case here: https://support.microsoft.com/en-us/getsupport?wf=0&tenant=classiccommercial&oaspworkflow=start_1.0.0.0&locale=en-us&supportregion=en-us&pesid=16068&forceorigin=esmc&ccsid=636645150473349054

    Monday, January 7, 2019 8:41 PM