简体   繁体   中英

Very simple Xamarin.Forms app won't Archive

I am working toward my first Android app and am having trouble. I am trying to Build and Archive the simplest possible Android app and can't get the Archive step to work.

Here is what I am doing...

  1. Start VS2017 Preview with Xamarin Preview extension and Xamarin Updater (everything fully updated)
  2. Run Android SDK Manager and install the following

     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. Create a new Cross Platform (App1) using defaults (Xamarin.Forms - Blank App - Shared Project), I make no changes to the code.

  4. Open 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. Set for Release and Build: Success

  6. Archive: The "LinkAssemblies" task failed unexpectedly.

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

Where am I going wrong? How can I be messing up such a simple blank template app?

If you go to the 'properties' tab for your android project and select 'Android Options' you will see a drop down list under the title 'Linking' Switch this so that it says 'None' and try again.

If this works, then try it again with 'SDK Assemblies Only'. Usually you get that error when it's found something that can't be linked natively.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM