Xamarin Android LinkAssemblies Task Failed Unexpectedly Acr Notifications
The 'LinkAssemblies task failed unexpectedly' error can be frustrating and hard to fix; we ran into an error and ended up having to keep Acr.Notifications from being linked to deploy in release mode.
Occassionally we run into a stubborn bug or issue, and we're hoping that someone can benefit from all the time that we pour into it. One such issue recently came up when we tried to release a new app into the Google Play store. Of course we'd been developing in Debug mode so we haven't run into the linker issues yet, so it was only just before we'd scheduled to deploy the app (well ahead of time of course, don't wait for the last minute for someone else to approve your work please!) that we discovered we had a linker problem. If you've run into these then you'll know that sometimes the real problem can be hard to find. You'll find solutions telling you to check the output window for errors- we solved those- and other people suggesting that you check logcat, which doesn't make sense to us when we're having a hard time building the app at all and not making it to the device. Of course we tried cleaning and rebuilding, and we even tried deleting the entire directory and retrieving all files from source control again.
What we ended up doing was tracing through the actual LinkAssemblies error looking for any assemblies referenced, whether we thought they were the problem, being called by the problem, or in any way referenced by the problem assembly. This led us to include Acr.Notifications from linking as pictured here:
And Voila! Our app was build and deployable. The best part is that, in the interest of making absolutely sure that we'd found the real issue, we removed our one change like any good developer would to double check, and the app still build and deployed. This has to be some kind of bug in Xamarin, since we could grab the code from source control that didn't work before and compile that very same code. This is a weird one, but I hope if anybody runs into the same issue he or she will at least be able to skip ahead to where we left off.