10

I've been banging my head against the wall for the last few days trying to figure this out.

Here is whats happening:

  1. Anytime I open the project VS hangs responding every once in a while for a click I made a minute or so before. While you watch task manager you see that AAPT.exe is popping up every few seconds and running for a moment, after about 3-5 minutes it completes whatever it is doing and vs starts working again until I do one of the other things that sets it off.
  2. Same thing when I clean the project.
  3. Same thing when I build/rebuild the project.
  4. When debugging to a physical device it will build and deploy to the device, then hang with the same issue for a few minutes before starting the debug

What I have discovered:

This issue could possibly be related to this bug report https://bugzilla.xamarin.com/show_bug.cgi?id=43081 however following the instructions provided on that don't help and only cause more errors.

It seems that aapt is crunching my pngs and that is causing the hang, however I only have a few small icons in terms of images in the entire project, nothing that should take 2-3 minutes to compress.

What I have tried:

  1. Update all android sdks and resources to the latest available.
  2. Update java(64bit) and removed all other instances of it besides the newest one
  3. Removed and reinstalled all android resources.
  4. Repaired Visual Studio(community 2015)
  5. Nuked VS with https://github.com/Microsoft/VisualStudioUninstaller/releases
  6. Attempted to install VS 2017 community however it never functioned with the error CLR20r3 from mscorlib 4.6.1 with the error being 'remoteHostService.servicehub.service.json' could not be found(I checked it existed where it should be, and it referenced VsixServiceDiscovery: A procedure imported by 'Microsoft.VisualStudio.Settings.15.0.dll' could not be loaded. (I unfortunately dont have the full trace anymore I got rid of 17)
  7. After all that I reinstalled vs 15, which I got working(barely) but it still has the exact same issue as when I started.

At this point my next step is to nuke my computer completely, which I don't really want to do, so I'm desperately hoping that someone knows how to fix this.

Taylor
  • 405
  • 3
  • 8
  • 20
  • Can you attach a diagnostic build output to your question? https://msdn.microsoft.com/en-us/library/jj651643.aspx – Jon Douglas Mar 13 '17 at 17:57
  • https://gist.github.com/Catalyse/5a2dee85416fcc6ac7c4a4aa56cffb0c this is on a rebuild. After the build was complete aapt.exe continued to hang vs for another 5 minutes. Im going to try and clean and do a full build to see if it looks any different – Taylor Mar 13 '17 at 18:15
  • @JonDouglas If it makes any difference I do have the android sdk modified(funny enough using your guide) for the proguard issue on 7.1 via http://stackoverflow.com/questions/39514518/xamarin-android-proguard-unsupported-class-version-number-52-0/39514706#39514706 – Taylor Mar 13 '17 at 18:21
  • I see `14495 ms _CompileToDalvikWithDx 1 calls` being the major culprit. This is however less than 30 seconds. We see`6701 ms Aapt 2 calls` however that's even less. I would suspect this Build only took about 30 seconds which is true based on the summary: `Time Elapsed 00:00:30.63`. I suspect something else is going on if the build only takes 30 seconds and yet aapt.exe is hanging for 5 minutes. Is this hang during build or just after? Can you use process explorer and hover the aapt.exe process to see what invoked it? – Jon Douglas Mar 13 '17 at 18:25
  • @JonDouglas Here are two screenshots of the aapt being called after the build. I noticed that when the system is building its called from MSBuild.exe, but after when the hang happens devenv is calling it directly. http://prntscr.com/ejjqx1 http://prntscr.com/ejjr6a – Taylor Mar 13 '17 at 19:56

1 Answers1

7

So after playing with a few things I noticed that a decent portion of the packages from NuGet in my solution had a triangle on them, for not having the reference.

Ultimately what I've figured out is that after each of the events that I described above, AAPT was actually redownloading every single one of the ~20 packages that I have in my solution because for some reason it had failed to link the project to the local copies despite being there.

The solution was discovered on this thread: https://forums.xamarin.com/discussion/89926/the-referenced-component-xamarin-android-support-xxx-could-not-be-found-after-upgrade-with-nuget

Ronald Peters

February 23

I fixed the yellow marks by forcing reinstall of packages: open NuGet Package Manager Console and execute "Update-Package –reinstall".

This forced all packages to remove all references from the project and reinstall themselves. Which ultimately most of them just found the local copy and just needed to be linked again.

After running this, VS no longer hangs after any of the events listed above, and everything seems to be working again.

Taylor
  • 405
  • 3
  • 8
  • 20