Reputation: 167
After updating to Xamarin.Forms 3.4.0.1009999, I get the following error when trying to run the application in release mode - The "LinkAssemblies" Task Failed Unexpectedly
I've searched this error and seen multiple threads on this issue but they were all previous versions of xamarin and non of the suggested solution seemed to work.
What I have tried though is:
Clearing bin and obj folders then rebuilding the solution.
Changing the linker behaviour
(turning it off), which actually works but a huge application is not an option.
Tried cleaning and building, instead of rebuilding, which is essentially the same thing, it was worth a shot though, it worked for someone else previously
Deleting and re-adding the Xamarin.Forms package from the Xamarin.Android project
log:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(5,5): Error MSB4018: The "LinkAssemblies" task failed unexpectedly.
Mono.Linker.MarkException: Error processing method: 'Android.Views.ScaleGestureDetector Xamarin.Forms.Platform.Android.GestureManager::InitializeScaleDetector()' in assembly: 'Xamarin.Forms.Platform.Android.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void Android.Support.V4.View.ScaleGestureDetectorCompat::SetQuickScaleEnabled(Android.Views.ScaleGestureDetector,System.Boolean)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod (Mono.Cecil.MethodReference reference) [0x00013] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference reference) [0x0004a] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at Mono.Linker.Steps.MarkStep.MarkInstruction (Mono.Cecil.Cil.Instruction instruction) [0x00040] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at Mono.Linker.Steps.MarkStep.MarkMethodBody (Mono.Cecil.Cil.MethodBody body) [0x00098] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00162] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x0001b] in <947dd92f52fa43c1922f96c7b9774bdc>:0
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00047] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue () [0x0000a] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at Mono.Linker.Steps.MarkStep.Process () [0x00102] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x0000d] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at MonoDroid.Tuner.MonoDroidMarkStep.Process (Mono.Linker.LinkContext context) [0x0000b] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x0001c] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at MonoDroid.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline, Mono.Linker.LinkContext context) [0x00000] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at MonoDroid.Tuner.Linker.Process (MonoDroid.Tuner.LinkerOptions options, Mono.Linker.ILogger logger, Mono.Linker.LinkContext& context) [0x00071] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at Xamarin.Android.Tasks.LinkAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x002d4] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at Xamarin.Android.Tasks.LinkAssemblies.Execute () [0x0021f] in <947dd92f52fa43c1922f96c7b9774bdc>:0
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784 (MSB4018) (LoyaltyWorx.Android)
I expected the project to run on the device like it did on previous versions of Xamarin.Forms without having to change the linker behaviour and increase the size of the application significantly.
Upvotes: 1
Views: 2537
Reputation: 2561
For me this issue wasn't solved as above. The solution was to set Linking to None, based on this post: https://forums.xamarin.com/discussion/146012/error-during-release-build
Upvotes: 0
Reputation: 7179
Update Xamarin.Android.Support libraries to v27. This typically solves the problem. Don't forget to clean and build, possibly restart Visual Studio
Upvotes: 3