Bug 41675 - Unable to build Android project
Summary: Unable to build Android project
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 4.1.0 (C7)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-06-10 00:03 UTC by Paul
Modified: 2016-07-11 20:50 UTC (History)
4 users (show)

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

Project to repro (14.56 KB, application/x-zip-compressed)
2016-06-10 00:03 UTC, Paul

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 on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Paul 2016-06-10 00:03:41 UTC
Created attachment 16261 [details]
Project to repro

Can not build this project that is actually nothing but default Android project created from standard template with some additional Nuget packages.
When I hit F5:
1. MSVS stuck at the start of building solution. It's not freezes it's just can not start build.
2. Cancel build
3. Hit F5 again
4. Build failed with some Resources related errors

My environment:
Win 8.1 Single Language, Intel Core i7, 12Gb RAM
Microsoft Visual Studio Community 2015
Version 14.0.25123.00 Update 2
Microsoft .NET Framework Version 4.6.01055
Xamarin (2e39740)
Xamarin.Android (4e27558)
Xamarin.iOS (39ebb77)

Project to repro in attachment.
Comment 1 Ben Beckley 2016-06-10 16:58:33 UTC
Hello Paul,

Thank you for filing this bug with the project attached along with reproduction steps. I've managed to successfully build the project, but it took quite a bit of time on `GetAdditionalResourcesFromAssemblies`.

>1>     3886 ms  CreateAdditionalLibraryResourceCache       1 calls
>1>     3888 ms  Csc                                        1 calls
>1>     4810 ms  Javac                                      1 calls
>1>     9960 ms  CompileToDalvik                            1 calls
>1>    11129 ms  Aapt                                      14 calls
>1>    82799 ms  GetAdditionalResourcesFromAssemblies       1 calls
>1>Build succeeded.
>1>Time Elapsed 00:02:03.90

For you, it could be potentially be downloading the resources which gives the appearance of a hanging build. The project will have to download the resources once, and then whenever there is a change to the resources. 
In C7 (the build you are using), we changed the cache location and improved the way this works. So if you have an existing project that is taking a long time to build after updating, this may be the reason for an abnormally long initial build.

Could you please do a few things so that we may find a solution?

- Enable diagnostic build outputs, and attach the log. You can enable this via "Tools > Options > Projects and Solutions > Build and Run" and then change the verbosity to diagnostic.

- After getting the logs, clean the `bin` and `obj` folders, and then attempt to build again.

- If that doesn't that work, clean `\Users\<username>\AppData\Local\Xamarin\zips` directory and try to build.

The logs are the most important though - so please include those. Thank you!
Comment 2 Paul 2016-06-10 17:02:41 UTC
Sorry, but I should work and I have no time to do this. I've downgraded to previous version of Xamarin
Comment 3 Paul 2016-07-11 05:47:06 UTC
In the development environment:

Microsoft Visual Studio Community 2015
Version 14.0.25421.03 Update 3
Xamarin (34a92cd)
Xamarin.Android (7db2aac)
Xamarin.iOS (3cf8aae)

It takes a very long time to build project for the first time but all works fine. Next time project builds quickly. So this bug should be closed as unable to repro.

P.S. Why not to show some message in the status bar of MSVS about long first time building?
Comment 4 Ben Beckley 2016-07-11 20:50:16 UTC
The behavior you've described aligns with the diagnosis in Comment 1.

As for including a message, this is something that the XVS and XA teams are aware of and have discussed. They have some ideas, but nothing concrete yet.