Xamarin.Android builds/deployments are very slow. How to speed them up?-ThrowExceptions

Exception or error:

We have a large Xamarin.Android project with two depending projects and a bunch of third party dll’s. Doing a debug deployment (without any changes) onto a Hax-x86 Emulator or a Nexus 5 device is painfully slow (> 80 seconds). For comparison the Xamarin.iOS version of the App deploys in under seven seconds onto a real device.

To test the deployment times I’ve also created a fresh Xamarin.Android project which deploys in about four seconds. When I add a depending project, the deploy time goes up to seven seconds. When I add a layout file to the depending project the deployment time increases to about ten seconds.

Is it possible to speed the Android build and deployment up with Xamarin Studio? A big Eclipse Android Projects is deployed rather quick in comparison.


Just running the installation build step takes about 40 seconds:

time xbuild /t:Install BigApp.csproj
Time Elapsed 00:00:42.8526970

about half the time is spend where the above command prints to console:

Target _CompileDex:
Tool /usr//bin/java execution started with arguments: -Xmx512M -jar 
--no-strict --dex --output=obj/Debug/android/bin/classes.dex obj/Debug/android/bin/classes

When I run the solution from Xamarin Studio this step happens twice. Once for the depending project and once for the main project. I tried to reproduce this behavior on the console with

"/Applications/Xamarin Studio.app/Contents/MacOS/mdtool" -v build "--configuration:Debug -t Install" "BigApp.sln"

but that only builds the main project.


I created a small demo project with very slow deployment time:

How to solve:

I contacted the Xamarin guys about this problem and they fixed two issues in Xamarin.Android:

The build time for my huge project without any changes is now ~5 seconds. And when making a code change in the deepest depending lib a deploy cycle does not take longer than 16 seconds.

Leave a Reply

Your email address will not be published. Required fields are marked *