Closed VysotskiVadim closed 7 years ago
Can you please try installing the Android Support Repository
under the Extras
section of your SDK manager and then try building again to see if that improves things?
@Redth, I've installed the Android Support Repository
but it didn't help, I still have the issue.
It affects not only me, see the discussion at: Xamarin forum Now we use similar workaround to avoid it...
@VysotskiVadim can you provide some diagnostic build output logs for when this happens? Also, how many resources are we talking about being "a lot" ?
@VysotskiVadim Can you also tell us what version of Visual Studio you are using?
Could you try this to get design-time logs too for this report? https://blogs.msdn.microsoft.com/jeremykuhne/2016/06/06/vs-background-builds/
@bholmes , I use Visual Studio version 14.0.25431.01 Update 3
@kzu Great idea! Thank you! I believe it exactly what I need, because I have no issues when I build project using cmd and msbuild, but when I use Visual Studio it's frozen for ~5 minutes after build.
I'm afraid I can't share logs with everybody because it maybe contains sensitive information about my customer, so I will analyze logs and get back.
@VysotskiVadim We are still investigating and attempting to reproduce the problem.
If you are willing I would like you to attempt a patch on the targets file that ships with Xamarin Build Download.
Edit the packages\Xamarin.Build.Download.0.4.2\build\Xamarin.Build.Download.targets file and add lines 42 and 51 to your file. YieldDuringExecution="true"
https://gist.github.com/bholmes/c7a47af2373a2c420f78e62194934b35
To be thorough I ask that you clean your project and restart VS.
For anyone interested, Xamarin Build Download is now open source. It may come in useful for those diagnosing issues.
I've set TRACEDESIGNTIME=true and found that when Visual Studio is frozen it creates 16 log files with name ProjectName_ResolveReferences_someHash.designtime
(example of some hash: 7ad07381).
@bholmes I will try apply patch that you described.
@bholmes I've applied patch that you described but it didn't help, Visual studio still doesn't response after build for ~5 minutes.
I also can share some information from VS designtime logs, maybe it help part-of-vs-designtime-logs.txt
Logs was collected before I applied patch.
@VysotskiVadim is this doing a rebuild? Or does a normal build take this long too?
@VysotskiVadim can you run the build from the command line please and gather the diagnostic output
msbuild
Just let it run if possible, it should give us an idea of what is going on. Aapt should not be running on a design time build.
I will describe the issue one more time and summarize what I've understood during investigation, just to make sure that we're on the same page.
I have no issues building project via command line. I have issue when I build via Visual studio: I run build, Visual Studio works good when build in progress, but when it's finished(I see Build succeeded in output) Visual Studio freezes for ~5minutes. I see that VS creates 16 design time logs while it's frozen. In each of this logs I see that target _UpdateAndroidResgen takes about 15-18 seconds to execute.
@Redth logs that I provided is design time logs, it happens after build. I've rebuild all project via command line and it took 00:01:47.67.
@dellis1972 I'm afraid I can't do this, because I've met this issue on production project, and I can't share full logs because it possible contains sensitive customer's information. I will appreciate it if you explain me how to analyze logs or ask me to provide you some specific part of log.
@bholmes @kzu @dellis1972
I've tried setting up a repro, so I have a solution with ~350 image drawable resources.
I enabled TRACEDESIGNTIME and collected logs just on opening the solution in VS2015. I noticed something peculiar. There are 11 files named SlowResgenTest_ResolveReferences_{UNIQUEID}.designtime.log
, and each seems to be a complete build of the target ResolveReferences
Ultimately ResolveReferences
looks like it depends on UpdateAndroidResgen
which is calling aapt and taking about 5 seconds for each one of these invocations:
ResolveReferencesDependsOn =
_SeparateAppExtensionReferences;
_PrepareWearApplication;
BeforeResolveReferences;
AssignProjectConfiguration;
ResolveProjectReferences;
FindInvalidProjectReferences;
ResolveNativeReferences;
ResolveAssemblyReferences;
GenerateBindingRedirects;
ResolveComReferences;
AfterResolveReferences
;
ResolveTestReferences
;
;
UpdateAndroidAssets;
UpdateAndroidInterfaceProxies;
UpdateAndroidResources;
;
;
ImplicitlyExpandDesignTimeFacades
Here's a gist of the full log output (one of the 11 anyway): https://gist.github.com/Redth/2b4cb65818f48f3beb0ed7eed27e3332
Coincidentally (or probably not), there are 11 android support libraries installed in this particular project...
@Redth Thank you for reproducing my issue! It's exactly what I have! But in my case each aapt call takes ~16 seconds.
While we're working on this, if it's really causing you a lot of trouble, what you can do for now as a temporary workaround is to do a build, and take the .dll's out of obj/Debug/XbdMerge
and copy them somewhere else, remove the matching nuget packages from your project and directly reference those .dll's instead.
Here is a sample I'm using to repro the issue.
I have just pushed a pre-release to NuGet that I believe will fix this issue. Please update all of your Xamarin Build Download packages to version 0.4.3-beta2. You will have to restart the IDE after the update and clean your builds.
@bholmes Looks like this pre-release fixes the issue.
@bholmes Fix works for me. Thank you!
Xamarin.Android Version: 7.1
Operating System & Version: Windows 10
Support Libraries Version: 25.1.1
Issue description:
I see that now all(or almost all) Android.Support.XXX packages depend on Xamarin.Build.Download package. Xamarin.Build.Download is a big issue for us. We have a pretty large Xamarin.Android project with a lot of resources and a lot of dependencies, so after upgrading to new Android.Support.XXX packages we also got Xamarin.Build.Download package. Now when I build or run project visual studio freezes for 5-10 minutes, and I see that process aapt.exe takes almost all of the CPU resources, when it finish visual studio starts to response. When I remove
<Import Project="..\packages\Xamarin.Build.Download.0.4.2\build\Xamarin.Build.Download.targets" Condition="Exists('..\packages\Xamarin.Build.Download.0.4.2\build\Xamarin.Build.Download.targets')" />
visual studio works well, and I'm able to run and debug project without waiting for 5-10 minutes.I've set build output to diagnostic but I don't see any logs after build, but again: visual studio doesn't response for 5-10 minutes and I see aapt.exe in the process list,
I'd like to help solve this issue, but I don't know how...