本文介绍了"LinkAssemblies"链接发布模式下的构建解决方案上任务意外失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目正在Debug模式下成功构建,但是当我将其更改为Release模式时;以下异常即将到来:

My project is building successfully on the Debug mode, but when I change it to the Release mode; the following exception is coming:

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()

推荐答案

由于直到API才引入KeyboardShortcutGroup,您可能需要将目标android版本(在使用Android版本编译"下的Android项目属性内)增加到API 24. 24.

You may need to increase your target android version (within the Android project properties under Compile using Android version) to API 24 since KeyboardShortcutGroup was not introduced until API 24.

这篇关于"LinkAssemblies"链接发布模式下的构建解决方案上任务意外失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 22:48