我的项目正在Debug
模式下成功构建,但当我将其更改为Release
模式时;以下异常即将发生:
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 'Android.Views.KeyboardShortcutGroup'
(defined in assembly 'Xamarin.Android.Support.v7.AppCompat,
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
differentfromthe defining assembly, it usually means that the type is
forwarded.---> Mono.Cecil.ResolutionException: Failed to
resolveAndroid.Views.KeyboardShortcutGroup
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkGenericArguments(IGenericInstance
instance)
at Mono.Linker.Steps.MarkStep.GetOriginalType(TypeReference type)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
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 Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Run(Pipeline pipeline, 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()
答案 0 :(得分:2)
您可能需要将目标Android版本(在使用Android版本的Compile下的Android项目属性中)增加到API 24,因为在API 24之前未引入KeyboardShortcutGroup
。