Bug 44622 - Xamarin Android Builds are excessively slow
Summary: Xamarin Android Builds are excessively slow
Status: NEEDINFO
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 7.0 (C8)
Hardware: PC Windows
: Highest normal
Target Milestone: master
Assignee: dean.ellis
URL:
: 51135 ()
Depends on:
Blocks:
 
Reported: 2016-09-22 13:43 UTC by Aaron Kiander
Modified: 2017-07-09 07:22 UTC (History)
9 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Build Output (278.35 KB, text/plain)
2016-12-23 12:10 UTC, Mauro P.
Details
Build log of Acquaint native app after I installed the patch (2.53 MB, text/plain)
2017-01-12 18:07 UTC, Mauro P.
Details
Build log of my project after I installed the patch (1.63 MB, text/plain)
2017-01-12 18:09 UTC, Mauro P.
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 44622 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEEDINFO

Description Aaron Kiander 2016-09-22 13:43:19 UTC
I work on a team with four other developers but build times on my machine are much slower than anyone else on the team. 

A clean and rebuild for the Xamarin Android project inside of Visual Studio 2015 is approximately 3-4 minutes while it is closer to 1 minute on other machines. I'm using the most recent stable versions of the product: 

Xamarin 4.2.0.680
Xamarin.Android 7.0.0.18
Xamarin.iOS 10.0.0.6
Microsoft Visual Studio Profession 2015 Version 14.0.25431.01 Update 3

Making a change and just building is 2-3 minutes on my machine while it appears to be 20-30 seconds on other machines. 

Our hardware specs are equivalent, so we don't believe this is a hardware issue. 

We've already tried disabling real time virus protection, windows search indexing and all file backup utilities, but the build times are not improved. 

I have searched widely across the Xamarin forums and the StackOverflow site but nothing helpful has emerged yet. 

I want to know what I can do to diagnose and fix this issue. Let me know what I should do next.
Comment 1 Mauro P. 2016-12-23 12:10:00 UTC
Created attachment 18983 [details]
Build Output

In last versions very often (not always but most of the times) the build process is very low, and this only for Android project (pcl build is extremely fast).
I cannot find a pattern in this behaviour.
I incremented Java Heap space to 2GB, I tried with and without Shared Mono Runtime, with and without Fast Assembly Deployment.
A couple of weeks ago I enabled Multi-Dex and upgraded target API SDK to 24 (and Support Library too), but only in last few days I started to see the problem.
Almost always between 3 and 5 minutes of build also when I don't change anything, it's starting to be frustrating...
Comment 2 dean.ellis 2017-01-03 11:26:17 UTC
Mauro

Sorry for the delay , I have been on holiday since the 17th of December.

Can you provide diagnostic build output with the PerformanceSummary enabled for the project you can having problems with. 

xbuild <your project.csproj> /t:SignAndroidPackage /v:d /clp:PerformanceSummary 

or (for windows)

msbuild <your project.csproj> /t:SignAndroidPackage /v:d /clp:PerformanceSummary 

you might need to provide /clp:PerformanceSummary=true on windows.. it depends on the msbuild version you are using.

You might be hitting an issue where the downloaded support lib zip md5 is being calculated every time (I can't remember the bug atm). It might be worth testing the alpha channel to see if that contains the fix.
Comment 3 Mauro P. 2017-01-03 11:32:53 UTC
Hi @Dean,
no problem, we do the same job and I know how important are holidays. I was worried only because the other guy reported this bug in September...
I opened another bug reporting just in case, and there you can see the detailed reports:
https://bugzilla.xamarin.com/show_bug.cgi?id=51135

It's confusing because sometimes works and sometimes it doesn't, this morning for instance the build is normal "a half" of the times, yesterday never, I cannot understand its behaviour.
I'm trying with physical device and with simulator. I see on your forum that people have this problem also on iOS.
Comment 4 dean.ellis 2017-01-03 11:37:41 UTC
Mauro

I looked at the diagnostic output on 51135. The problem is where I expected it was the call to GetAdditionalResourcesFromAssemblies. 

This is related to this commit 

https://github.com/xamarin/xamarin-android/commit/2f690ca7d0c18055b01649de19b596df1626d3e2

which should be in the alpha channel (I think). I will ask about getting that into a stable patch. 

In the mean time I will try to see if there is a way I can provide a patches Xamarin.Android.Build.Tasks.dll for people hitting this issue.

Note it will only effect the latest Support library Nuget packages since they were the ones that shipped with the new SHA attribute property. The older libraries did not so they should not hit the issue. 

I have no idea why iOS projects would be seeing this since they use a completely different build system to android.

I'm going to make the other bug as a duplicate of this one so we can keep all the information in one place.
Comment 5 dean.ellis 2017-01-03 11:37:53 UTC
*** Bug 51135 has been marked as a duplicate of this bug. ***
Comment 6 Mauro P. 2017-01-03 11:45:36 UTC
Great, thank you Dean. The most important thing is that the bugtracker is alive and that you can provide some kind of solution to evident bugs.
Comment 7 akiander 2017-01-03 14:08:24 UTC
Hi everyone - thanks for following up on this issue. Since I created this issue, I received a new computer and the problem went away. I do think something was corrupted with my original xamarin configuration on my old computer, and that likely caused the slowness. But since I no longer have my old computer, I cannot verify any of it. The new computer works well - builds are faster, more inline with the rest of the team. Please close this issue unless others feel that it needs to remain open.
Comment 8 Justin Toth 2017-01-09 16:05:57 UTC
I'm running into the same slowness issue now after upgrading my Xamarin and Android SDK packages. After upgrading I had to enable multi dex support, as it was the only way to get past the stupid max references error caused by having all of the Xamarin.Android.Support and Xamarin.GooglePlayServices packages. I was assuming the slowness was related to multi dex, but it sounds like from the comments above it's just a bug in the latest Xamarin packages.

Any update on this?

Thanks!
Justin
Comment 9 Justin Toth 2017-01-10 17:31:53 UTC
Below is the performance summary. There are a number of really slow tasks, but GetAdditionalResourcesFromAssemblies is taking 130 seconds!!

Target perfomance summary:
     2.276 ms  _AddCorlibReference                                     1 calls
     1.620 ms  _AddDebugStaticResources                                1 calls
    24.438 ms  _AddLibraryProjectsEmbeddedResourceToProject            1 calls
     0.338 ms  _AddMultiDexDependencyJars                              1 calls
     6.629 ms  _AddStaticResources                                     1 calls
   172.451 ms  _AdjustJavacVersionArguments                            1 calls
130292.254 ms  _BuildAdditionalResourcesCache                          1 calls
    88.489 ms  _BuildLibraryImportsCache                               1 calls
   214.272 ms  _BuildSdkCache                                          1 calls
     2.494 ms  _CalculateAdditionalResourceCacheDirectories            1 calls
     0.733 ms  _CheckDuplicateJavaLibraries                            1 calls
     0.074 ms  _CheckForContent                                        1 calls
     0.158 ms  _CheckForDeletedResourceFile                            1 calls
     0.195 ms  _CheckForInvalidConfigurationAndPlatform                1 calls
     0.483 ms  _CheckInstantRunCondition                               1 calls
     0.666 ms  _CheckProjectItems                                      1 calls
     0.104 ms  _CheckTargetFramework                                   1 calls
   110.672 ms  _CheckTargetFrameworks                                  1 calls
   197.316 ms  _CollectAdditionalResourceFiles                         1 calls
    12.606 ms  _CollectConfigFiles                                     1 calls
    10.193 ms  _CollectMdbFiles                                        1 calls
    99.820 ms  _CollectMonoAndroidOutputs                              1 calls
     9.010 ms  _CollectPdbFiles                                        1 calls
     0.941 ms  _CompileDex                                             1 calls
  3631.907 ms  _CompileJava                                            1 calls
 15054.739 ms  _CompileToDalvikWithDx                                  1 calls
     0.935 ms  _ComputeAndroidAssetsPaths                              1 calls
   254.316 ms  _ComputeAndroidResourcePaths                            1 calls
     0.373 ms  _ConvertPdbFiles                                        1 calls
     0.489 ms  _CopyConfigFiles                                        1 calls
    92.937 ms  _CopyIntermediateAssemblies                             1 calls
   129.902 ms  _CopyMdbFiles                                           1 calls
   688.320 ms  _CreateAdditionalResourceCache                          1 calls
 13569.952 ms  _CreateBaseApk                                          1 calls
     3.322 ms  _CreateIntermediateAssembliesDir                        1 calls
     0.495 ms  _CreatePackageWorkspace                                 1 calls
     0.680 ms  _CreatePropertiesCache                                  1 calls
     0.345 ms  _DefineBuildTargetAbis                                  1 calls
    14.603 ms  _DetermineJavaLibrariesToCompile                        1 calls
     0.933 ms  _ExtractLibraryProjectImports                           1 calls
   259.546 ms  _FindCompiledJavaFiles                                  1 calls
   111.019 ms  _FindJavaStubFiles                                      1 calls
    10.957 ms  _GenerateAndroidAssetsDir                               1 calls
  1864.464 ms  _GenerateAndroidResourceDir                             1 calls
 12244.379 ms  _GenerateJavaDesignerForComponent                       1 calls
  2626.629 ms  _GenerateJavaStubs                                      1 calls
     7.797 ms  _GeneratePackageManagerJava                             1 calls
    28.467 ms  _GenerateTargetFrameworkMonikerAttribute                1 calls
    12.273 ms  _GetAdditionalResourcesFromAssemblies                   1 calls
     2.014 ms  _GetAddOnPlatformLibraries                              1 calls
     0.692 ms  _GetCompileOutputsForClean                              1 calls
     0.885 ms  _GetLibraryImports                                      1 calls
     1.132 ms  _GetMonoPlatformJarPath                                 1 calls
    67.459 ms  _GetPrimaryCpuAbi                                       1 calls
     0.472 ms  _GetReferenceAssemblyPaths                              1 calls
     0.077 ms  _IncludeInstanceRunReference                            1 calls
   435.942 ms  _LinkAssembliesNoShrink                                 1 calls
     8.364 ms  _PrepareAssemblies                                      1 calls
     0.073 ms  _ReadPropertiesCache                                    1 calls
   193.232 ms  _RecordCleanFile                                        1 calls
   316.129 ms  _ResolveAssemblies                                      1 calls
   232.034 ms  _ResolveLibraryProjectImports                           1 calls
     8.804 ms  _ResolveMonoAndroidSdks                                 1 calls
    96.057 ms  _ResolveSatellitePaths                                  1 calls
     0.211 ms  _SeparateAppExtensionReferences                         1 calls
   109.988 ms  _SetLatestTargetFrameworkVersion                        1 calls
     0.240 ms  _SetupApplicationJavaClass                              1 calls
     0.042 ms  _SetupDesignTimeBuildForBuild                           1 calls
     0.102 ms  _SetupDesignTimeBuildForIntellisense                    1 calls
     0.222 ms  _SetupInstantRun                                        1 calls
     2.828 ms  _StripEmbeddedLibraries                                 1 calls
 15237.928 ms  _UpdateAndroidResgen                                    1 calls
     5.022 ms  _ValidateAndroidPackageProperties                       1 calls
     0.058 ms  _ValidateLinkMode                                       1 calls
     0.122 ms  _ValidateResourceCache                                  1 calls
     2.795 ms  _WriteResolvedAssemblies                                1 calls
     0.175 ms  AssignLinkMetadata                                      1 calls
     1.353 ms  AssignProjectConfiguration                              1 calls
     1.584 ms  AssignTargetPaths                                       2 calls
     0.702 ms  BclBuildValidateNugetPackageReferences                  1 calls
    31.584 ms  CopyFilesMarkedCopyLocal                                1 calls
  2138.883 ms  CoreCompile                                             1 calls
     0.230 ms  CreateManifestResourceNames                             1 calls
     5.187 ms  DeployOutputFiles                                       1 calls
     0.168 ms  GenerateResources                                       1 calls
     0.092 ms  GenerateSatelliteAssemblies                             1 calls
     4.896 ms  GenerateTargetFrameworkMonikerAttribute                 1 calls
    67.236 ms  GetCopyToOutputDirectoryItems                           2 calls
    13.798 ms  GetReferenceAssemblyPaths                               1 calls
    73.337 ms  ImplicitlyExpandDesignTimeFacades                       1 calls
     0.845 ms  PrepareForBuild                                         1 calls
     0.251 ms  ProcessGoogleServicesJsonChecks                         1 calls
    46.352 ms  ResolveAssemblyReferences                               1 calls
    65.633 ms  ResolveProjectReferences                                1 calls
     0.692 ms  SplitProjectReferencesByExistent                        2 calls
     0.747 ms  SplitResourcesByCulture                                 1 calls
     0.478 ms  VectorDrawableCheckBuildToolsVersionTask                1 calls

Tasks perfomance summary:
 36612.001 ms  Aapt                                                   21 calls
   172.348 ms  AdjustJavacVersionArguments                             1 calls
   254.772 ms  AndroidComputeResPaths                                  2 calls
     0.162 ms  AssignCulture                                           1 calls
     0.603 ms  AssignProjectConfiguration                              1 calls
     1.332 ms  AssignTargetPath                                        6 calls
     1.587 ms  CalculateAdditionalResourceCacheDirectories             1 calls
     0.673 ms  CheckDuplicateJavaLibraries                             1 calls
     0.588 ms  CheckProjectItems                                       1 calls
   110.585 ms  CheckTargetFrameworks                                   1 calls
     1.085 ms  CollectLibraryAssets                                    1 calls
 10810.941 ms  CompileToDalvik                                         1 calls
  5740.052 ms  ConvertResourcesCases                                   3 calls
  1558.363 ms  Copy                                                    9 calls
     7.925 ms  CopyGeneratedJavaResourceClasses                        2 calls
    27.765 ms  CopyIfChanged                                           1 calls
    98.837 ms  CopyMdbFiles                                            1 calls
     2.377 ms  CopyResource                                            4 calls
   682.886 ms  CreateAdditionalLibraryResourceCache                    1 calls
    27.652 ms  CreateAndroidResourceStamp                              1 calls
   681.672 ms  CreateItem                                             45 calls
    24.095 ms  CreateManagedLibraryResourceArchive                     1 calls
  4170.449 ms  CreateMultiDexMainDexClassList                          1 calls
     6.595 ms  CreateProperty                                         43 calls
     3.969 ms  CreateResgenManifest                                    1 calls
     1.357 ms  CreateTemporaryDirectory                                2 calls
  2121.344 ms  Csc                                                     1 calls
     0.462 ms  Delete                                                  1 calls
    13.340 ms  DetermineJavaLibrariesToCompile                         1 calls
     0.264 ms  FindAppConfigFile                                       1 calls
     3.476 ms  FindUnderPath                                           1 calls
   710.645 ms  GenerateJavaStubs                                       1 calls
     5.216 ms  GeneratePackageManagerJava                              1 calls
   343.821 ms  GenerateResourceDesigner                                1 calls
130281.005 ms  GetAdditionalResourcesFromAssemblies                    1 calls
     1.948 ms  GetAddOnPlatformLibraries                               1 calls
     0.480 ms  GetAndroidDefineConstants                               1 calls
     0.785 ms  GetAndroidPackageName                                   1 calls
     0.637 ms  GetAppSettingsDirectory                                 1 calls
    19.821 ms  GetExtraPackages                                        2 calls
    13.981 ms  GetFilesThatExist                                       3 calls
    79.920 ms  GetImportedLibraries                                    1 calls
     0.647 ms  GetJavaPlatformJar                                      1 calls
     1.072 ms  GetMonoPlatformJar                                      1 calls
    67.167 ms  GetPrimaryCpuAbi                                        1 calls
     2.670 ms  GetReferenceAssemblyPaths                               2 calls
  3605.900 ms  Javac                                                   1 calls
   432.228 ms  LinkAssemblies                                          1 calls
     1.735 ms  MakeDir                                                 6 calls
     2.081 ms  Message                                                16 calls
   130.510 ms  MSBuild                                                 2 calls
     2.132 ms  ReadAdditionalResourcesFromAssemblyCache                1 calls
     0.748 ms  ReadImportedLibrariesCache                              1 calls
     0.864 ms  ReadLibraryProjectImportsCache                          1 calls
     0.337 ms  ReadLinesFromFile                                       1 calls
   109.057 ms  ReadResolvedSdksCache                                   1 calls
     9.135 ms  RemoveDirFixed                                          2 calls
   161.368 ms  RemoveDuplicates                                        1 calls
   162.035 ms  RemoveUnknownFiles                                      2 calls
   309.221 ms  ResolveAssemblies                                       1 calls
   140.621 ms  ResolveAssemblyReference                                2 calls
   223.376 ms  ResolveLibraryProjectImports                            1 calls
   214.031 ms  ResolveSdks                                             1 calls
   246.752 ms  Touch                                                  10 calls
     0.411 ms  ValidatePackageReferences                               1 calls
     0.438 ms  VectorDrawableCheckBuildToolsVersionTask                1 calls
    31.433 ms  WriteLinesToFile
Comment 10 dean.ellis 2017-01-12 11:37:22 UTC
This should be fixed in the latest version in the alpha channel. Xamarin.Android 7.1.0.19 

It is related to the following fix https://github.com/xamarin/xamarin-android/commit/2f690ca7d0c18055b01649de19b596df1626d3e2

Note the first build might be a bit slow since the hash file needs to be created. But it will be quick on subsequent builds (for all projects) since the hash file is in a global location.

This hash was done as part of the work to stop issues with broken/partial downloads of zips. 

The reason it happens is because only the latest versions of the support libraries contain the SHA1 attribute property. So it will only happen on projects targeting the latest support libraries. 

If someone can confirm it is fixed in the version I have specified that would be great.
Comment 11 Justin Toth 2017-01-12 16:33:51 UTC
I think you improved it somewhat, before it was taking 3-5 minutes to build, however it's still really slow (a little over a minute.) Even if I don't make any code changes between builds, it still takes just as long. Aapt looks to be the main culprit. 

Is this because I have multi-dex enabled? (Which I have no control over, because the Xamarin Android Support and Google Play Services packages require a million dependencies, which easily take you over the limit.)

Target perfomance summary:
     2.220 ms  _AddCorlibReference                                     1 calls
     0.807 ms  _AddDebugStaticResources                                1 calls
    20.192 ms  _AddLibraryProjectsEmbeddedResourceToProject            1 calls
     0.323 ms  _AddMultiDexDependencyJars                              1 calls
     2.188 ms  _AddStaticResources                                     1 calls
   172.544 ms  _AdjustJavacVersionArguments                            1 calls
   147.469 ms  _BuildAdditionalResourcesCache                          1 calls
    80.043 ms  _BuildLibraryImportsCache                               1 calls
   215.578 ms  _BuildSdkCache                                          1 calls
     2.691 ms  _CalculateAdditionalResourceCacheDirectories            1 calls
     0.630 ms  _CheckDuplicateJavaLibraries                            1 calls
     0.108 ms  _CheckForContent                                        1 calls
     0.083 ms  _CheckForDeletedResourceFile                            1 calls
     0.146 ms  _CheckForInvalidConfigurationAndPlatform                1 calls
     0.472 ms  _CheckInstantRunCondition                               1 calls
     0.921 ms  _CheckProjectItems                                      1 calls
     0.097 ms  _CheckTargetFramework                                   1 calls
   144.385 ms  _CheckTargetFrameworks                                  1 calls
   184.001 ms  _CollectAdditionalResourceFiles                         1 calls
     7.873 ms  _CollectConfigFiles                                     1 calls
    13.206 ms  _CollectMdbFiles                                        1 calls
   104.670 ms  _CollectMonoAndroidOutputs                              1 calls
    11.700 ms  _CollectPdbFiles                                        1 calls
     0.842 ms  _CompileDex                                             1 calls
  3387.120 ms  _CompileJava                                            1 calls
 14988.087 ms  _CompileToDalvikWithDx                                  1 calls
     0.885 ms  _ComputeAndroidAssetsPaths                              1 calls
   232.774 ms  _ComputeAndroidResourcePaths                            1 calls
     0.390 ms  _ConvertPdbFiles                                        1 calls
     0.483 ms  _CopyConfigFiles                                        1 calls
    96.499 ms  _CopyIntermediateAssemblies                             1 calls
   104.555 ms  _CopyMdbFiles                                           1 calls
   423.139 ms  _CreateAdditionalResourceCache                          1 calls
 12853.161 ms  _CreateBaseApk                                          1 calls
     1.304 ms  _CreateIntermediateAssembliesDir                        1 calls
     0.468 ms  _CreatePackageWorkspace                                 1 calls
     0.746 ms  _CreatePropertiesCache                                  1 calls
     0.396 ms  _DefineBuildTargetAbis                                  1 calls
     9.135 ms  _DetermineJavaLibrariesToCompile                        1 calls
     0.922 ms  _ExtractLibraryProjectImports                           1 calls
   221.649 ms  _FindCompiledJavaFiles                                  1 calls
   119.945 ms  _FindJavaStubFiles                                      1 calls
     2.748 ms  _GenerateAndroidAssetsDir                               1 calls
  1021.633 ms  _GenerateAndroidResourceDir                             1 calls
 12066.323 ms  _GenerateJavaDesignerForComponent                       1 calls
  2014.778 ms  _GenerateJavaStubs                                      1 calls
     4.461 ms  _GeneratePackageManagerJava                             1 calls
     4.734 ms  _GenerateTargetFrameworkMonikerAttribute                1 calls
     8.305 ms  _GetAdditionalResourcesFromAssemblies                   1 calls
     1.250 ms  _GetAddOnPlatformLibraries                              1 calls
     0.560 ms  _GetCompileOutputsForClean                              1 calls
     0.855 ms  _GetLibraryImports                                      1 calls
     0.494 ms  _GetMonoPlatformJarPath                                 1 calls
     1.467 ms  _GetPrimaryCpuAbi                                       1 calls
     0.445 ms  _GetReferenceAssemblyPaths                              1 calls
     0.076 ms  _IncludeInstanceRunReference                            1 calls
   412.983 ms  _LinkAssembliesNoShrink                                 1 calls
     8.426 ms  _PrepareAssemblies                                      1 calls
     0.082 ms  _ReadPropertiesCache                                    1 calls
   200.863 ms  _RecordCleanFile                                        1 calls
   316.883 ms  _ResolveAssemblies                                      1 calls
   194.072 ms  _ResolveLibraryProjectImports                           1 calls
     5.373 ms  _ResolveMonoAndroidSdks                                 1 calls
    38.022 ms  _ResolveSatellitePaths                                  1 calls
     0.209 ms  _SeparateAppExtensionReferences                         1 calls
   109.142 ms  _SetLatestTargetFrameworkVersion                        1 calls
     0.196 ms  _SetupApplicationJavaClass                              1 calls
     0.047 ms  _SetupDesignTimeBuildForBuild                           1 calls
     0.065 ms  _SetupDesignTimeBuildForIntellisense                    1 calls
     0.165 ms  _SetupInstantRun                                        1 calls
     2.851 ms  _StripEmbeddedLibraries                                 1 calls
 14188.759 ms  _UpdateAndroidResgen                                    1 calls
     1.811 ms  _ValidateAndroidPackageProperties                       1 calls
     0.063 ms  _ValidateLinkMode                                       1 calls
     0.102 ms  _ValidateResourceCache                                  1 calls
     2.414 ms  _WriteResolvedAssemblies                                1 calls
     0.196 ms  AssignLinkMetadata                                      1 calls
     0.901 ms  AssignProjectConfiguration                              1 calls
     1.533 ms  AssignTargetPaths                                       2 calls
     0.708 ms  BclBuildValidateNugetPackageReferences                  1 calls
    34.158 ms  CopyFilesMarkedCopyLocal                                1 calls
  2161.594 ms  CoreCompile                                             1 calls
     0.199 ms  CreateManifestResourceNames                             1 calls
     5.927 ms  DeployOutputFiles                                       1 calls
     0.156 ms  GenerateResources                                       1 calls
     0.082 ms  GenerateSatelliteAssemblies                             1 calls
     4.438 ms  GenerateTargetFrameworkMonikerAttribute                 1 calls
    71.459 ms  GetCopyToOutputDirectoryItems                           2 calls
    21.291 ms  GetReferenceAssemblyPaths                               1 calls
    67.902 ms  ImplicitlyExpandDesignTimeFacades                       1 calls
     0.990 ms  PrepareForBuild                                         1 calls
     0.237 ms  ProcessGoogleServicesJsonChecks                         1 calls
    50.140 ms  ResolveAssemblyReferences                               1 calls
    62.849 ms  ResolveProjectReferences                                1 calls
     0.472 ms  SplitProjectReferencesByExistent                        2 calls
     0.718 ms  SplitResourcesByCulture                                 1 calls
     0.491 ms  VectorDrawableCheckBuildToolsVersionTask                1 calls

Tasks perfomance summary:
 35502.766 ms  Aapt                                                   21 calls
   172.435 ms  AdjustJavacVersionArguments                             1 calls
   233.205 ms  AndroidComputeResPaths                                  2 calls
     0.160 ms  AssignCulture                                           1 calls
     0.400 ms  AssignProjectConfiguration                              1 calls
     1.309 ms  AssignTargetPath                                        6 calls
     1.778 ms  CalculateAdditionalResourceCacheDirectories             1 calls
     0.573 ms  CheckDuplicateJavaLibraries                             1 calls
     0.814 ms  CheckProjectItems                                       1 calls
   144.312 ms  CheckTargetFrameworks                                   1 calls
     0.696 ms  CollectLibraryAssets                                    1 calls
 11051.356 ms  CompileToDalvik                                         1 calls
  4548.857 ms  ConvertResourcesCases                                   3 calls
   789.532 ms  Copy                                                    9 calls
     7.510 ms  CopyGeneratedJavaResourceClasses                        2 calls
    11.704 ms  CopyIfChanged                                           1 calls
    68.525 ms  CopyMdbFiles                                            1 calls
     1.350 ms  CopyResource                                            4 calls
   416.686 ms  CreateAdditionalLibraryResourceCache                    1 calls
    28.080 ms  CreateAndroidResourceStamp                              1 calls
   644.730 ms  CreateItem                                             45 calls
    19.993 ms  CreateManagedLibraryResourceArchive                     1 calls
  3872.809 ms  CreateMultiDexMainDexClassList                          1 calls
     4.868 ms  CreateProperty                                         45 calls
     1.585 ms  CreateResgenManifest                                    1 calls
     0.847 ms  CreateTemporaryDirectory                                2 calls
  2142.309 ms  Csc                                                     1 calls
     0.428 ms  Delete                                                  1 calls
     8.223 ms  DetermineJavaLibrariesToCompile                         1 calls
     0.325 ms  FindAppConfigFile                                       1 calls
     3.625 ms  FindUnderPath                                           1 calls
   536.189 ms  GenerateJavaStubs                                       1 calls
     2.518 ms  GeneratePackageManagerJava                              1 calls
   303.495 ms  GenerateResourceDesigner                                1 calls
   138.429 ms  GetAdditionalResourcesFromAssemblies                    1 calls
     1.183 ms  GetAddOnPlatformLibraries                               1 calls
     0.400 ms  GetAndroidDefineConstants                               1 calls
     0.555 ms  GetAndroidPackageName                                   1 calls
     0.407 ms  GetAppSettingsDirectory                                 1 calls
    15.311 ms  GetExtraPackages                                        2 calls
    16.385 ms  GetFilesThatExist                                       3 calls
    71.707 ms  GetImportedLibraries                                    1 calls
     0.575 ms  GetJavaPlatformJar                                      1 calls
     0.433 ms  GetMonoPlatformJar                                      1 calls
     1.173 ms  GetPrimaryCpuAbi                                        1 calls
     3.073 ms  GetReferenceAssemblyPaths                               2 calls
  3359.273 ms  Javac                                                   1 calls
   411.503 ms  LinkAssemblies                                          1 calls
     1.517 ms  MakeDir                                                 6 calls
     1.582 ms  Message                                                16 calls
   132.017 ms  MSBuild                                                 2 calls
     2.699 ms  ReadAdditionalResourcesFromAssemblyCache                1 calls
     0.736 ms  ReadImportedLibrariesCache                              1 calls
     0.856 ms  ReadLibraryProjectImportsCache                          1 calls
     0.286 ms  ReadLinesFromFile                                       1 calls
   107.667 ms  ReadResolvedSdksCache                                   1 calls
     5.626 ms  RemoveDirFixed                                          2 calls
   172.252 ms  RemoveDuplicates                                        1 calls
   130.787 ms  RemoveUnknownFiles                                      2 calls
   308.566 ms  ResolveAssemblies                                       1 calls
    86.331 ms  ResolveAssemblyReference                                2 calls
   182.325 ms  ResolveLibraryProjectImports                            1 calls
   215.327 ms  ResolveSdks                                             1 calls
   226.514 ms  Touch                                                  10 calls
     0.420 ms  ValidatePackageReferences                               1 calls
     0.449 ms  VectorDrawableCheckBuildToolsVersionTask                1 calls
    27.688 ms  WriteLinesToFile

Time Elapsed 00:01:06.9622010
Comment 12 dean.ellis 2017-01-12 17:25:27 UTC
I recently pushed a change to the Aapt Task on our master branch that should improve that time [1] and [2]. But that probably won't be available until C10 (which is the release after the current alpha RC). 


Mauro are you able to confirm Justin's findings? (about GetAdditionalResourcesFromAssemblies), is that fixed for you in the Alpha channel?

[1] https://github.com/xamarin/xamarin-android/commit/f93149eb4bc456301d7e9b4fb8c9b8228a20cf2f
[2] https://github.com/xamarin/xamarin-android/commit/aa3ac5cc8566fe22745f2f9bb392fb7ae5cea2ea
Comment 13 Mauro P. 2017-01-12 18:05:07 UTC
I download the update from the alpha channel, restarted Xamarin Studio and checked that the 7.1.0.19 was installed.
Build of my project now is faster but not as fast as before the bug, a bit more than one minute.
I tried to build the Acquaint native app and that's one too is slow (around 40 seconds). On that one Multidex is disabled.
Comment 14 Mauro P. 2017-01-12 18:07:35 UTC
Created attachment 19312 [details]
Build log of Acquaint native app after I installed the patch
Comment 15 Mauro P. 2017-01-12 18:09:48 UTC
Created attachment 19313 [details]
Build log of my project after I installed the patch
Comment 16 Brendan Zagaeski (Xamarin Team, assistant) 2017-03-23 20:49:48 UTC
(This comment is partly just for my own future reference.)




## Bookkeeping note on the location of the change mentioned in Comment 10

> INCLUDED     in Xamarin.Android 7.2.0.2  "15.1 Beta Preview 1"       (which uses https://github.com/xamarin/xamarin-android/tree/1a2330336b9c0499efee5c85566a0e99bc437b96)
> INCLUDED     in Xamarin.Android 7.1.0.43 "Cycle 9 Service Release 0" (which uses https://github.com/xamarin/xamarin-android/tree/cc7bde0678a031a0afd383a4e14521070920d9f3)
> INCLUDED     in Xamarin.Android 7.1.0.41 "Cycle 9"                   (which uses https://github.com/xamarin/xamarin-android/tree/cc7bde0678a031a0afd383a4e14521070920d9f3)
> NOT included in Xamarin.Android 7.0.2.42 "Cycle 8 Service Release 2" (which uses https://github.com/xamarin/xamarin-android/tree/124e901b81999911c550ea0a207b1180fc4531c8)



## Bookkeeping note on the location of the changes mentioned in Comment 12

> INCLUDED     in Xamarin.Android 7.2.0.2  "15.1 Beta Preview 1"       (which uses https://github.com/xamarin/xamarin-android/tree/1a2330336b9c0499efee5c85566a0e99bc437b96)
> NOT included in Xamarin.Android 7.1.0.43 "Cycle 9 Service Release 0" (which uses https://github.com/xamarin/xamarin-android/tree/cc7bde0678a031a0afd383a4e14521070920d9f3)
> NOT included in Xamarin.Android 7.1.0.41 "Cycle 9"                   (which uses https://github.com/xamarin/xamarin-android/tree/cc7bde0678a031a0afd383a4e14521070920d9f3)