我在2-3个月前创建了xamarin traditinal android项目,但我需要更新这个项目,但我收到错误;
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
答案 0 :(得分:1)
错误XA2006:无法解析对System.Void的引用。Android.App.Activity :: OnMultiWindowModeChanged(System.Boolean)&#39; (在汇编中定义&#39; Xamarin.Android.Support.Fragment,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null&#39;),范围&#39; Mono.Android,版本= 0.0.0.0,文化=中立,PublicKeyToken = 84e04ff9cfb79065&#39;。
请检查onMultiWindowModeChanged API,它是在API级别24中添加的。正如@MCZ建议的那样,this is a known issue。
您可以尝试更改以下设置:
此外,Android 7.0需要Android JDK 1.8,我认为你可能已经安装了它,因为你可以提前构建你的应用程序,请查看工具中的 Java开发工具包位置 - &gt;选项 - &GT;你的VS2017的Xamarin。
答案 1 :(得分:0)
使用visual studio check linker属性时,它主要设置为&#34; None&#34;你必须改变它。
并检查TargetAndroidVersion。 (在配置GUI中,这标题为&#34;使用Android版本进行编译:&#34;)