muratoner
muratoner

Reputation: 2672

Xamarin Traditional Android Project Build On Visual Studio 2017 But Have Error

I created xamarin traditinal android project 2-3 months ago but I need update this project but I'm getting an 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.Void Android.App.Activity::OnMultiWindowModeChanged(System.Boolean)' (defined in assembly 'Xamarin.Android.Support.Fragment, Version=1.0.0.0, 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.Void Android.App.Activity::OnMultiWindowModeChanged(System.Boolean)
   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.<ExecuteInstantiatedTask>d__26.MoveNext() MHG.SozumSana.UI

Upvotes: 0

Views: 1093

Answers (2)

Grace Feng
Grace Feng

Reputation: 16652

error XA2006: Could not resolve reference to 'System.Void Android.App.Activity::OnMultiWindowModeChanged(System.Boolean)' (defined in assembly 'Xamarin.Android.Support.Fragment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') with scope 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'.

Please check the onMultiWindowModeChanged API, it is added in API level 24. As @MCZ suggested, this is a known issue.

You can try to change the settings like this:

enter image description here

Besides, Android 7.0 needs Android JDK 1.8, I think you may have installed it since you can build your app earlier, please check the Java Development Kit Location in Tools -> Options-> Xamarin of your VS2017.

Upvotes: 1

Moien.Dev
Moien.Dev

Reputation: 1058

While using visual studio check linker property it mostly set to "None" that you have to change it.

And check TargetAndroidVersion. (In the config GUI, this is entitled "Compile using Android version:")

Upvotes: 0

Related Questions