If Linker is disabled the apk is about 30% bigger. Thus this is important for my game.
To reproduce:
- create a new project with the MonoGame Android template;
- set Target Framework to Android 4.2;
- enabled Linker to SDK and User Assemblies.
Here is the error:
Severity Code Description Project File Line Suppression State
Error The “LinkAssemblies” task failed unexpectedly.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to ‘System.Boolean[] Android.Views.InputDevice::HasKeys(System.Int32[])’ (defined in assembly ‘MonoGame.Framework, Version=3.6.0.1625, Culture=neutral, PublicKeyToken=null’) with scope ‘Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065’. When the scope is different from the defining assembly, it usually means that the type is forwarded. —> Mono.Cecil.ResolutionException: Failed to resolve System.Boolean[] Android.Views.InputDevice::HasKeys(System.Int32[])
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
— End of inner exception stack trace —
at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() SimpleAndroidTest