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



  • AleksandarLUKICAleksandarLUKIC USMember ✭✭

    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.

  • Slava87Slava87 UAMember

    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

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University, Xamarin Moderator Xamurai
    edited February 2017


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

  • baigzbaigz PKMember

    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.

  • NateVargheseNateVarghese USUniversity ✭✭
    edited February 2017

    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.

  • DeanEllisDeanEllis USXamarin Team Xamurai

    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.

  • JoeyZacherlJoeyZacherl USMember ✭✭
    edited March 2017

    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:


    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.

  • JoeyZacherlJoeyZacherl USMember ✭✭
    edited March 2017

    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.

  • AndyDentAndyDent AUMember ✭✭
    edited March 2017

    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

  • AndyDentAndyDent AUMember ✭✭

    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.testmigratefrom77_1droid/md50576fb6928abddee0e8c9d637bb1d306.MainActivity"
    > Starting: Intent { cmp=io.realm.testmigratefrom77_1droid/md50576fb6928abddee0e8c9d637bb1d306.MainActivity }
    Error type 3
    Error: Activity class {io.realm.testmigratefrom77_1droid/md50576fb6928abddee0e8c9d637bb1d306.MainActivity} does not exist.
  • AdriVermeulenAdriVermeulen USMember

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

  • BillDehortyBillDehorty USMember

    FWIW...I encountered a similar issue and a found a different work-around. (I am using VS2017 Community 15.2 Release 26430.6 + Xamarin + Xamarin.Android SDK 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.

  • TigerLionCheetahTigerLionCheetah CAMember ✭✭

    [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.


  • ahmeddriraahmeddrira USMember

    hey guys any news??

  • AlanJonesRiosAlanJonesRios USMember ✭✭

    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.

  • M_AllanM_Allan USMember ✭✭

    I think the leader of Xamarin team need to leave.

  • jjtudujjtudu Member ✭✭

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

  • BlakeWillsMCBlakeWillsMC GBUniversity

    @DeanEllis - I'm getting this intermittently on the latest version of VS Enterprise (15.5.2) and Xamarin version 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)

  • knocteknocte GBMember ✭✭

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

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University, Xamarin Moderator Xamurai


    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.

  • knocteknocte GBMember ✭✭

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

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University, Xamarin Moderator Xamurai

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

    For component, select General.

  • BlakeWillsMCBlakeWillsMC GBUniversity

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

  • AlexanderLysenkoAlexanderLysenko USMember ✭✭

    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.

  • abdullahtahan.7433abdullahtahan.7433 SAMember ✭✭

    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

  • abdullahtahan.7433abdullahtahan.7433 SAMember ✭✭

    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

Sign In or Register to comment.