Can't build .apk for release

ChWoChWo DEMember

Hello,

I can build an .apk in debug mode but can't do it in release mode. What is wrong?
I get this error:

Error 85 The "LinkAssemblies" task failed unexpectedly. Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'Android.Text.InputTypes Android.Widget.SearchView::get_InputType()' (defined in 'Xamarin.Forms.Platform.Android, Version=1.2.1.0, Culture=neutral, PublicKeyToken=null') from 'Xamarin.Forms.Platform.Android, Version=1.2.1.0, Culture=neutral, PublicKeyToken=null' could not be resolved. at Xamarin.Android.Diagnostic.Error(Int32 code, String message, Object[] args) at Xamarin.Android.Tasks.LinkAssemblies.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 970 5 MyApp.Droid

And I get this ourput:

`Building Package

Project "MyApp.Droid.csproj" (SignAndroidPackage target(s)):
Project "NuGet.targets" (_DownloadNuGet target(s)):
Done building project "NuGet.targets".
Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file:
Project "DK.Ostebaronen.Droid.ViewpagerIndicator.csproj" (Build target(s)):
Project "NuGet.targets" (_DownloadNuGet target(s)):
Done building project "NuGet.targets".
Done building project "DK.Ostebaronen.Droid.ViewpagerIndicator.csproj".
Project "MyApp.Core.csproj" (Build target(s)):
Project "NuGet.targets" (_DownloadNuGet target(s)):
Done building project "NuGet.targets".
Project "MyCompany.StaticPluginProvider.csproj" (GetTargetPath target(s)):
Done building project "MyCompany.StaticPluginProvider.csproj".
Project "MyCompany.StaticPluginProvider.csproj" (GetNativeManifest target(s)):
Done building project "MyCompany.StaticPluginProvider.csproj".
Could not resolve this reference. Could not locate the assembly "Cirrious.MvvmCross". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
No way to resolve conflict between "Cirrious.MvvmCross, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e16445fd9b451819" and "Cirrious.MvvmCross". Choosing "Cirrious.MvvmCross, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e16445fd9b451819" arbitrarily.
'MyApp.Core.Pages.DatasetDetailPage.Layout' hides inherited member 'Xamarin.Forms.VisualElement.Layout(Xamarin.Forms.Rectangle)'. Use the new keyword if hiding was intended.
This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
'Xamarin.Forms.Font.BoldSystemFontOfSize(Xamarin.Forms.NamedSize)' is obsolete: 'BoldSystemFontOfSize is obsolete, please use SystemFontOfSize (NamedSize, FontAttributes)'
'Xamarin.Forms.Font.BoldSystemFontOfSize(Xamarin.Forms.NamedSize)' is obsolete: 'BoldSystemFontOfSize is obsolete, please use SystemFontOfSize (NamedSize, FontAttributes)'
'Xamarin.Forms.Font.BoldSystemFontOfSize(Xamarin.Forms.NamedSize)' is obsolete: 'BoldSystemFontOfSize is obsolete, please use SystemFontOfSize (NamedSize, FontAttributes)'
'Xamarin.Forms.Font.BoldSystemFontOfSize(Xamarin.Forms.NamedSize)' is obsolete: 'BoldSystemFontOfSize is obsolete, please use SystemFontOfSize (NamedSize, FontAttributes)'
'Xamarin.Forms.NavigationPage.Tint' is obsolete: 'Use BarBackgroundColor and BarTextColor to change NavigationPage bar color properties'
Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.
Project "MyCompany.StaticPluginProvider.csproj" (GetCopyToOutputDirectoryItems target(s)):
Done building project "MyCompany.StaticPluginProvider.csproj".
Project "MyCompany.StaticPluginProvider.csproj" (GetPackagingOutputs target(s)):
Done building project "MyCompany.StaticPluginProvider.csproj".
Done building project "MyApp.Core.csproj".
Project "MyCompany.StaticPluginProvider.csproj" (Build target(s)):
Done building project "MyCompany.StaticPluginProvider.csproj".
Project "DK.Ostebaronen.Droid.ViewpagerIndicator.csproj" (GetTargetPath target(s)):
Done building project "DK.Ostebaronen.Droid.ViewpagerIndicator.csproj".
Project "MyApp.Core.csproj" (GetTargetPath target(s)):
Done building project "MyApp.Core.csproj".
Project "MyCompany.StaticPluginProvider.csproj" (GetTargetPath target(s)):
Done building project "MyCompany.StaticPluginProvider.csproj".
Project "DK.Ostebaronen.Droid.ViewpagerIndicator.csproj" (GetNativeManifest target(s)):
Done building project "DK.Ostebaronen.Droid.ViewpagerIndicator.csproj".
Project "MyApp.Core.csproj" (GetNativeManifest target(s)):
Done building project "MyApp.Core.csproj".
Project "MyCompany.StaticPluginProvider.csproj" (GetNativeManifest target(s)):
Done building project "MyCompany.StaticPluginProvider.csproj".
Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file:
'MyApp.Droid.Views.Fragments.DisqualifyLeadFragment.EditViewModel' hides inherited member 'MyApp.Droid.Views.Fragments.DatasetEditFragment.EditViewModel'. Use the new keyword if hiding was intended.
'MyApp.Droid.Views.Fragments.ReopenLeadFragment.EditViewModel' hides inherited member 'MyApp.Droid.Views.Fragments.DatasetEditFragment.EditViewModel'. Use the new keyword if hiding was intended.
'MyApp.Droid.Views.Fragments.QualifyLeadFragment.EditViewModel' hides inherited member 'MyApp.Droid.Views.Fragments.DatasetEditFragment.EditViewModel'. Use the new keyword if hiding was intended.
'Xamarin.Forms.NavigationPage.Tint' is obsolete: 'Use BarBackgroundColor and BarTextColor to change NavigationPage bar color properties'
Project "DK.Ostebaronen.Droid.ViewpagerIndicator.csproj" (GetCopyToOutputDirectoryItems target(s)):
Done building project "DK.Ostebaronen.Droid.ViewpagerIndicator.csproj".
Project "MyApp.Core.csproj" (GetCopyToOutputDirectoryItems target(s)):
Done building project "MyApp.Core.csproj".
Project "MyCompany.StaticPluginProvider.csproj" (GetCopyToOutputDirectoryItems target(s)):
Done building project "MyCompany.StaticPluginProvider.csproj".
Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file:
The "LinkAssemblies" task failed unexpectedly.
Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'Android.Text.InputTypes Android.Widget.SearchView::get_InputType()' (defined in 'Xamarin.Forms.Platform.Android, Version=1.2.1.0, Culture=neutral, PublicKeyToken=null') from 'Xamarin.Forms.Platform.Android, Version=1.2.1.0, Culture=neutral, PublicKeyToken=null' could not be resolved.
at Xamarin.Android.Diagnostic.Error(Int32 code, String message, Object[] args)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext()
Done building project "MyApp.Droid.csproj" -- FAILED.`

Posts

  • ChWoChWo DEMember

    I still get the same error as last night. I lost two full days because of this error.
    Debug configuration builds.

    @Xamarin Please help me!

  • JonathanPryorJonathanPryor USXamarin Team Xamurai

    What is your $(TargetFrameworkVersion)?

    Android.Widget.SearchView::get_InputType() was added in API-16 (Android v4.1), so if your $(TargetFrameworkVersion) references an earlier version, e.g. API-14 *(Android v4.0), then the member won't exist and the linker will error out.

  • ChWoChWo DEMember

    Thank you! Sometimes it's that easy to solve hard problems. My TargetFrameworkVersion was API-15.

  • SrdanBoovicSrdanBoovic RSMember

    It seems that I have the same problem :(

    Where can I check what's my $(TargetFrameworkVersion)?

  • @SrdanBoovic, Right Click on your project options, project option dialog would appear. Under build, change your target framework.

    image

    image

    Also, under Android Application, change your Target Android Version.

  • fernandopfernandop USMember ✭✭

    Hi,
    how can I create an app for Android 4.0 without getting this error? thanks.

  • fernandopfernandop USMember ✭✭

    After changing to API 16 I get this:

    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(5,5): Error MSB4018: The "LinkAssemblies" task failed unexpectedly.
    Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'System.Void Android.Views.View::set_TextAlignment(Android.Views.TextAlignment)' (defined in 'Xamarin.Forms.Platform.Android, Version=1.2.3.0, Culture=neutral, PublicKeyToken=null') from 'Xamarin.Forms.Platform.Android, Version=1.2.3.0, Culture=neutral, PublicKeyToken=null' could not be resolved.
    at Xamarin.Android.Diagnostic.Error(Int32 code, String message, Object[] args)
    at Xamarin.Android.Tasks.LinkAssemblies.Execute()
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext() (MSB4018) (Scanpack.net.Android)

  • fernandopfernandop USMember ✭✭

    Fixed setting target to Android 4.4.

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    I've created the apk for 4.1.1 following intructions on this thread, but when I copy apk on the tablet and run it, the installation forms appers and remain on the dislay for an infinite time...
    There is a reason for this behavior?

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    any comment?

  • KenWenyonKenWenyon USMember, University
    edited February 2015

    In Visual Studio 2013 12.0.31101.00 (Update 4)
    Xamarin 3.9.340.0
    Xamarin.Android: 4.20.0.34
    Xamarin.iOS: 8.6.2.0
    Xamarin.iOS Unified Migration: 1.0

    I am trying to build in Debug mode and in Release mode.
    Under VS Android Project Properties,
    Android Options Tab, Linker, Linking is set to: Sdk and User Assemblies.
    Application Tab
    My: Compile using Android version: API Level 16
    My: Minimum Android Target to target: API Level 16
    My: I have tried to change my Target Android version: API Level 14 through API Level 21 and Use Compile using SDK version, each time I clean and build I get the same error as shown below.

    Android.Widget.AbsListView::SetSelectionFromTop(System.Int32,System.Int32) is in at least API Level 13 and Higher

    Error 30 The "LinkAssemblies" task failed unexpectedly.
    Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'System.Void Android.Widget.AbsListView::SetSelectionFromTop(System.Int32,System.Int32)' (defined in 'Xamarin.Forms.Platform.Android, Version=1.3.3.0, Culture=neutral, PublicKeyToken=null') from 'Xamarin.Forms.Platform.Android, Version=1.3.3.0, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void Android.Widget.AbsListView::SetSelectionFromTop(System.Int32,System.Int32)
    at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
    at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
    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.Process(LinkerOptions options, LinkContext& context)
    at Xamarin.Android.Tasks.LinkAssemblies.Execute()
    --- End of inner exception stack trace ---
    at Xamarin.Android.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
    at Xamarin.Android.Tasks.LinkAssemblies.Execute()
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext() SureCheck.Mobile.Android

  • ChWoChWo DEMember

    Set your target Android version to v5.0 in order to use Xamarin.Forms 1.3.x in release mode.

  • ApurvaGoyalApurvaGoyal USMember ✭✭

    Setting to Android version to v5.0 still doesnt solve the issue.

  • MichaelParenti.2346MichaelParenti.2346 FRMember
    edited April 2015

    Hello,
    Is there an update to this problem ?
    I'm trying to build an application and get this kind of error :


    Erreur 1 Échec inattendu de la tâche "LinkAssemblies".
    Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'Android.Text.InputTypes Android.Widget.SearchView::get_InputType()' (defined in 'Xamarin.Forms.Platform.Android, Version=1.4.0.0, Culture=neutral, PublicKeyToken=null') from 'Xamarin.Forms.Platform.Android, Version=1.4.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve Android.Text.InputTypes Android.Widget.SearchView::get_InputType()
    à Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
    à Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
    à Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
    à Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
    à Mono.Linker.Steps.MarkStep.ProcessQueue()
    à Mono.Linker.Steps.MarkStep.Process()
    à Mono.Linker.Steps.MarkStep.Process(LinkContext context)
    à Mono.Linker.Pipeline.Process(LinkContext context)
    à MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
    à Xamarin.Android.Tasks.LinkAssemblies.Execute()
    --- Fin de la trace de la pile d'exception interne ---
    à Xamarin.Android.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
    à Xamarin.Android.Tasks.LinkAssemblies.Execute()
    à Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    à Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext() HScrollDemo.Droid


    I tried using DSK 15 to 21 and always get this error.
    I've update Xamarin.Android.Support.V4 to version 22 but always the same.

    Many thanks.

    Update: Using API Level 21 (V5.0) works. But I don't have any device for testing my application :wink:

  • PieterNuyts.4634PieterNuyts.4634 BEUniversity ✭✭

    @JonathanPryor thanks a lot that solved my problem!
    The error message is rather vague for this one..

  • ELinaresELinares USMember

    I have the same problem

    Error   5   The "LinkAssemblies" task failed unexpectedly.
    Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'Android.Support.V4.Internal.View.ISupportMenu' (defined in 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') from 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve Android.Support.V4.Internal.View.ISupportMenu
       at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
       at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
       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.Process(LinkerOptions options, LinkContext& context)
       at Xamarin.Android.Tasks.LinkAssemblies.Execute()
       --- End of inner exception stack trace ---
       at Xamarin.Android.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
       at Xamarin.Android.Tasks.LinkAssemblies.Execute()
       at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
       at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() Altipal.Mobile.Store.Android.UI
    

    How I can solve this error?

  • Miguel.9535Miguel.9535 USMember
    edited August 2015

    I had the same error but if you change the linker to "sdk and User Assemblies" it fixed. I had the minimun Android to target at API level 15 and the Target Android Version to "Use compile using SDK version"

Sign In or Register to comment.