EXTREMELY slow to deploy to physical Android device in Visual Studio 2013

I'm seeing a full deployment time of about 140 seconds (from the time I push the run button until the application appears on my device). This is with "use fast deployment" enabled. It takes 180 seconds without that option. All the other settings are the default for a Xamarin Forms project using PCLs. I've verified similar times from a plain Android application.

The messages in the VS toolbar say "build started..." for a long time and eventually changes to "packaging application" after about 90 seconds. The status bar often reverts to "ready" (or goes blank) for long periods of time (but while still building). Visual Studio freezes during the build process sometimes. The output window doesn't get populated until the final 10 seconds or so, which makes me wonder if it's doing nothing for the first 130 seconds.

The physical device is a Sony Xperia Z2 running Android 5.0.2.

This has made learning the framework extremely frustrating and borderline unusable.

Perhaps of interest is that in the Xamarin.Forms application, blanking the form dropped build time to 60 seconds after restarting VS. Adding xmlns:local="clr-namespace:DemoApp;assembly=DemoApp" and the list view that I'm trying to create brings it back up to 140 seconds (and crashes the application because I must be doing something wrong with binding, but the slow build time has made experimentation difficult).

Tagged:

Answers

  • MikeHoffertMikeHoffert USMember

    The extremely slow build also applies to just re-running the program without any changes (eg, to add a breakpoint). This is pretty much unusable as a result. Debugging just takes too long.

    Having fixed the crashing in the last paragraph of my previous post, I can say that it's not the cause.

  • MikeHoffertMikeHoffert USMember

    This seems to have disappeared somehow. I have not figured out how to reproduce it or what I did to fix the issue. Deployment time is now ~10 seconds.

  • JoseMirallesJoseMiralles USMember ✭✭

    I am currently having this issue, for physical and emulated devices. It seems to take 1 or 2 minutes and it really slows down testing. I am on Visual Studio and I had to disable fast assemblies (I think that was what I had to disable) since it wouldn't build otherwise.

  • flyingxuflyingxu CNMember

    I'm having the same issue. the most time consuming step is:
    C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.2\zipalign.exe

  • Bogdan0x400Bogdan0x400 USUniversity ✭✭

    I am having same issue. The deployment itself doesn't take much, but it takes forever to run in debug. The worst thing is that I don't know why, the build output is not informative about it, and I haven't found a way to configure it to be more verbose.

  • Seeing this issue here as well.

  • TariqQubtiTariqQubti USMember

    Not sure if it is related but I had the same issue, zipalign took 3 minutes, I went to Tools>>Options>>Xamarin>>Android Settings, and found that the Java Development Kit location to be pointing to jdk1.7 I downloaded jdk1.8 from oracle and pointed the Java Development Kit location to the new jdk1.8 and it seems to be faster now, hope this helps someone...

  • DerekFoulkDerekFoulk USMember

    I have had multiple issues with a fresh install of Visual Studio 2017 Professional/Xamarin. Any XForms project refuses to deploy in a timely manner. The "Blank App" (the one that literally has just a single label with "Welcome..." text) takes 20-30mins to launch on my 'Android x86' emulator (API 23) when in configured for Debug.

    I am working on a fix, but so far I noticed a decent chunk of time is spent launching the emulator if you have Hyper-V enabled on your machine. To disable Hyper-V, open a command prompt and run:

    $ bcdedit /set hypervisorlaunchtype off
    

    It won't fix the slow deployment completely but it seems to save a few minutes!


    @Bogdan0x400 - To configure Verbosity of Xamarin logs:

    Open Visual Studio > Tools > Options > Xamarin > Android Settings > Xamarin Diagnostics > Output Verbosity.

    Also note that you can export Xamarin logs via:

    Help > Xamarin > Zip Logs...

    Hope that helps!

  • KevinYuKevinYu USMember

    on the latest forms tools, seeing this issue. any fix?

  • I even get the slow deployment on my physical device. Strange thing..

  • kamenackamenac Member

    For me, adding zipalign.exe to the Defender exclusions list helped.

  • gilleslebgillesleb Member ✭✭

    I'm also seeing the issue. On a MacBook with Visual Studio for Mac, deployment is pretty snappy.
    When switching to the same solution it takes minutes to deploy. The last message in the console when that happens is the zipalign.exe one.

    I checked the path of my JDK like Tariq mentionned and it's pointing at the correct place.

    I added an exclusion to Windows Defender for zipalign.exe and that helped out a lot but it's really slow compared to on my Mac (the Mac has less rams, less cpu power, etc.).

    Any ideas ?

  • TyreekusTyreekus USMember

    I've been having the same issue. With a fresh Xamarin.Form project the build time is about 20 minutes and that is building to a physical Note 8. This is making Xamarin completely useless for me. For the past week, I've tried advice from numerous forums with no luck. This is extremely frustrating, I can't get back the time I've lost. This software is completely useless in its current state. This is my first impression of Xamarin and it's complete trash.

  • LeonMeijerLeonMeijer NLMember

    So glad I discovered this forum thread. I suffered from slow device deployments. Excluding zipalign.exe and the Android SDK folder (in my case C:\Users\\AppData\Local\Android from Windows Defender solved it. From several minutes down to 15 seconds. Still, sometimes for unknown reasons, like 2 minutes.

  • JasonWeierJasonWeier Member

    Still seeing this issue with Visual Studio 2019. I was able to resolve the issue by disabling Hypver-V and Hypervisor in Add/Remove Windows Features. I had enabled them in an attempt to improve performance on the emulator. I can now deploy and debug on my physical device in a matter of seconds, not minutes.

Sign In or Register to comment.