非常简单的Xamarin.Forms应用程序赢得了归档

时间:2017-07-06 14:12:53

标签: android xamarin.forms

我正在努力开发我的第一款Android应用,但遇到了麻烦。我正在尝试构建和存档最简单的Android应用程序,并且无法使存档步骤起作用。

这是我正在做的......

  1. 使用Xamarin预览扩展和Xamarin更新程序(一切都已完全更新)启动VS2017预览
  2. 运行Android SDK Manager并安装以下

    Android SDK Tools 25.2.5
    Android SDK Platform-tools 26
    Android SDK Build-tools 26
    Android SDK Build-tools 25.0.3
    Android SDK Build-tools 25.0.2
    Android SDK Build-tools 25.0.1
    Android SDK Build-tools 25
    SDK Platform 25.3
    Android Support Repository 47
    Google Play Services 42
    Instant Apps Development SDK 1
    Google Play Licensing Library 1
    Google Play Billing Library 5
    Google USB Driver 11
    Google Web Driver 2
    Emulator 26
    
  3. 使用默认值创建新的跨平台(App1)(Xamarin.Forms - 空白应用程序 - 共享项目),我不对代码进行任何更改。

  4. 打开App1.Android Poperties

    Compile using Android version: Android 7.1 (Nougat)
    Package Name: App1
    Version number: 1
    Version name: 1.0
    Minimum Android version: Android 7.1 (API Level 25 - Nougat)
    Target Android version: Android 7.1 (API Level 25 - Nougat)
    Linking: Sdk Assemblies Only
    Everything else are default values
    
  5. 设置发布和构建:成功

  6. 存档:" LinkAssemblies"任务意外失败。

     Mono.Linker.MarkException: Error processing method: 'TNativeView Xamarin.Forms.Platform.Android.ViewRenderer'2::get_Control()' in assembly: 'Xamarin.Forms.Platform.Android.dll' ---> System.ArgumentNullException: Value cannot be null.
    Parameter name: instruction
       at Mono.Cecil.Cil.InstructionOffset..ctor(Instruction instruction)
       at Mono.Cecil.Cil.CodeReader.ReadScope(ScopeDebugInformation scope)
       at Mono.Cecil.Cil.CodeReader.ReadScopes(Collection'1 scopes)
       at Mono.Cecil.Cil.CodeReader.ReadScope(ScopeDebugInformation scope)
       at Mono.Cecil.Cil.CodeReader.ReadScopes(Collection'1 scopes)
       at Mono.Cecil.Cil.CodeReader.ReadScope(ScopeDebugInformation scope)
       at Mono.Cecil.Cil.CodeReader.ReadDebugInfo()
       at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
       at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
       at Mono.Cecil.MethodDefinition.<>c.<get_Body>b__41_0(MethodDefinition method, MetadataReader reader)
       at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func'3 read)
       at Mono.Cecil.MethodDefinition.get_Body()
       at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
       at Mono.Linker.Steps.MarkStep.ProcessQueue()
       --- End of inner exception stack trace ---
       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.Process(LinkerOptions options, LinkContext& context)
       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()
    
  7. 我哪里错了?我怎么能弄乱这么简单的空白模板应用呢?

1 个答案:

答案 0 :(得分:0)

如果您转到Android项目的“属性”标签并选择“Android选项”,您会在“链接”标题下看到一个下拉列表,将其设置为“无”,然后重试。

如果此方法有效,请使用“仅限SDK Assemblies”再次尝试。通常,当发现无法原生链接的内容时,您会收到该错误。