Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio (xamarin) hanging on every build, clean, or rebuild with AAPT.exe running in the background while it does this

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.

like image 785
Taylor Avatar asked Mar 13 '17 17:03

Taylor


1 Answers

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.

like image 179
Taylor Avatar answered Nov 16 '22 06:11

Taylor