0

尝试在发布模式下构建 Xamarin.Android 项目并Like SDK assemblies only启用会产生以下错误:

    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(5,5): Error MSB4018: The "LinkAssemblies" task failed unexpectedly.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'System.Void Android.Support.CustomTabs.CustomTabsIntent::LaunchUrl(Android.App.Activity,Android.Net.Uri)' (defined in assembly 'Plugin.Share, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null') with scope 'Xamarin.Android.Support.CustomTabs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. 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.Support.CustomTabs.CustomTabsIntent::LaunchUrl(Android.App.Activity,Android.Net.Uri)
    at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference reference) [0x0006e] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:963 
    at Mono.Linker.Steps.MarkStep.MarkInstruction (Mono.Cecil.Cil.Instruction instruction) [0x00048] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:1183 
    at Mono.Linker.Steps.MarkStep.MarkMethodBody (Mono.Cecil.Cil.MethodBody body) [0x000a5] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:1173 
    at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00191] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:1052 
    at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00022] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:156 
    at Mono.Linker.Steps.MarkStep.Process () [0x00019] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:115 
    at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x0000f] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:60 
    at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00023] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/linker/linker/Mono.Linker/Pipeline.cs:118 
    at MonoDroid.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline, Mono.Linker.LinkContext context) [0x00001] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/Linker.cs:34 
    at MonoDroid.Tuner.Linker.Process (MonoDroid.Tuner.LinkerOptions options, Mono.Linker.LinkContext& context) [0x0007b] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/Linker.cs:29 
    at Xamarin.Android.Tasks.LinkAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x002ff] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/LinkAssemblies.cs:145 
    --- End of inner exception stack trace ---
    at Java.Interop.Tools.Diagnostics.Diagnostic.Error (System.Int32 code, System.Exception innerException, System.String message, System.Object[] args) [0x00001] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Diagnostics/Java.Interop.Tools.Diagnostics/Diagnostic.cs:163 
    at Xamarin.Android.Tasks.LinkAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x004a0] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/LinkAssemblies.cs:185 
    at Xamarin.Android.Tasks.LinkAssemblies.Execute () [0x0022f] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/LinkAssemblies.cs:92 
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/msbuild-15.0/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:632 
    at Microsoft.Build.BackEnd.TaskBuilder+<ExecuteInstantiatedTask>d__26.MoveNext () [0x00249] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/msbuild-15.0/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:787  (MSB4018) (Clikmotors.Droid)

配置:

  • macOS Sierra 10.12.5
  • Visual Studio for Mac 7.0.1(内部版本 24)
  • Xamarin.Android 7.3.1.2
  • 项目目标 SDK:API 25 (Nougat 7.1)

Android SDK 的区域都是最新的: 在此处输入图像描述

与编译器和存储库一样: 在此处输入图像描述

我还尝试忽略项目配置中的 Plugin.Share 程序集。这些都不起作用,我编译应用程序的唯一方法是禁用链接。

4

1 回答 1

0

Xamarin 论坛上发布了相同的问题。可以在那里找到确切的答案:“[Plugins.Share] 6.1.0.19-beta 是针对 25.1.1 构建的,并在 25-1-1-support 分支上的测试示例应用程序中经过验证。5.x 将保留在 23 .x 支持库”

于 2017-08-02T09:58:59.060 回答