Bug 20362 - Error Executing task LinkAssemblies for Android Release Build
Summary: Error Executing task LinkAssemblies for Android Release Build
Status: RESOLVED INVALID
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.0.6188
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-06-04 21:32 UTC by aziz
Modified: 2015-02-20 13:51 UTC (History)
12 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description aziz 2014-06-04 21:32:10 UTC
Every time I try to compile the Android project of my Xamarin.Forms PCL Project using the Release profile, I get:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Error executing task LinkAssemblies: error XA2006: Reference to metadata item 'Android.Text.InputTypes Android.Widget.SearchView::get_InputType()' (defined in 'Xamarin.Forms.Platform.Android, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') from 'Xamarin.Forms.Platform.Android, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved. (USFSPConnect.Android)

Full Buid Log: http://pastebin.com/yBDQChaV
Comment 5 Jason Smith [MSFT] 2014-07-22 16:47:33 UTC
This is correct. The compile and target versions need to be set to at least 4.4. The minimum version should be set to ICS. We optionally will use newer features when on newer platforms.
Comment 6 Jason Smith [MSFT] 2014-07-22 16:47:45 UTC
This is correct. The compile and target versions need to be set to at least 4.4. The minimum version should be set to ICS. We optionally will use newer features when on newer platforms.
Comment 7 John Miller [MSFT] 2014-07-22 17:44:15 UTC
I was seeing this issue, and I think I was confused before. 

### Possible Workaround

Make sure your Project -> Options -> Build -> General -> Target Framework is set to Android 4.4 or higher. 

You can set the Project -> Options -> Android Application -> Minimum Android Version to 4.0 or higher. Also, set the Target Android Version to 4.4. 

There is a great resource on these settings and how they work here: http://redth.codes/such-android-api-levels-much-confuse-wow/
Comment 8 Jatin 2014-08-26 08:40:26 UTC
Hi,

I have tried it on my machine and able to reproduce it, using the attached project in the bug.

And also, I have checked that as per the steps in comment #7 it works fine.

Hence, marking it as confirmed.
Comment 9 Jatin 2014-08-26 08:45:27 UTC
Also this issue can be reproducible using below steps:

1. Create Android form PCL Project
2. Make sure the Target framework in less than 4.4
3. Build the project
4. Same error as mentioned in the original bug appears.

Environment info:

=== Xamarin Studio ===

Version 5.3 (build 435)
Installation UUID: 522f0c5e-80a3-4414-aec7-1f3b9c1768d1
Runtime:
	Microsoft .NET 4.0.30319.18408
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.25

=== Xamarin.Android ===

Version: 4.16.0 (Business Edition)
Android SDK: C:\Users\Admin\AppData\Local\Android\android-sdk
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: C:\Program Files\Java\jdk1.6.0_39
java version "1.6.0_39"
Java(TM) SE Runtime Environment (build 1.6.0_39-b04)
Java HotSpot(TM) Client VM (build 20.14-b01, mixed mode, sharing)

=== Build Information ===

Release ID: 503000435
Git revision: 1e0c5fa7482a0356a71dfa469a3f71f5478a4660
Build date: 2014-08-25 12:47:56-04
Xamarin addins: 69708b283b171ea053d0edfbf09d98457d21fbee

=== Operating System ===

Windows 6.1.7601.65536
Comment 10 Jason Smith [MSFT] 2014-09-23 00:53:52 UTC
we do not support lowering the target framework. Are you saying the templates are producing artificially lowered target frameworks?
Comment 11 Jason Smith [MSFT] 2014-09-23 00:54:22 UTC
Please re-open if the issue is caused without user intervention :)
Comment 12 Brendan Zagaeski (Xamarin Team, assistant) 2014-09-24 16:28:13 UTC
Bug for the incorrect TargetFrameworkVersion in the Xamarin Studio
Xamarin.Forms templates filed here:
https://bugzilla.xamarin.com/show_bug.cgi?id=22182
Comment 13 Vincent Poirier 2014-12-23 09:19:24 UTC
This problem happens on Xamarin.Forms 1.3 pre-4.
See the following thread: http://forums.xamarin.com/discussion/comment/93830/#Comment_93830

Here's the log:
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(5,5): Error MSB4018: Échec inattendu de la tâche "LinkAssemblies".
Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'Xamarin.Forms.BindableProperty Xamarin.Forms.BindableProperty::Create(System.Linq.Expressions.Expression`1<System.Func`2<!!0,!!1>>,!!1,Xamarin.Forms.BindingMode,Xamarin.Forms.BindableProperty/ValidateValueDelegate`1<!!1>,Xamarin.Forms.BindableProperty/BindingPropertyChangedDelegate`1<!!1>,Xamarin.Forms.BindableProperty/BindingPropertyChangingDelegate`1<!!1>,Xamarin.Forms.BindableProperty/CoerceValueDelegate`1<!!1>)' (defined in 'OxyPlot.XamarinForms, Version=2014.1.546.0, Culture=neutral, PublicKeyToken=null') from 'OxyPlot.XamarinForms, Version=2014.1.546.0, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve Xamarin.Forms.BindableProperty Xamarin.Forms.BindableProperty::Create(System.Linq.Expressions.Expression`1<System.Func`2<!!0,!!1>>,!!1,Xamarin.Forms.BindingMode,Xamarin.Forms.BindableProperty/ValidateValueDelegate`1<!!1>,Xamarin.Forms.BindableProperty/BindingPropertyChangedDelegate`1<!!1>,Xamarin.Forms.BindableProperty/BindingPropertyChangingDelegate`1<!!1>,Xamarin.Forms.BindableProperty/CoerceValueDelegate`1<!!1>)
   à 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.<ExecuteInstantiatedTask>d__20.MoveNext() (MSB4018) (Klaim.Droid)
Comment 14 Vincent Poirier 2014-12-23 09:20:19 UTC
Note that this happens only when building as a Release.
Comment 15 Mike Hamilton 2015-01-02 16:10:53 UTC
I'm currently having this issue with Xamarin.Forms 1.3.1-pre.

My Target Framework, Minimum Android Version and Target Android version are all set to 4.4 (API 19). The app builds fine in Debug mode, but fails with the following error in Release mode:

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 'Xamarin.Forms.BindableProperty Xamarin.Forms.BindableProperty::Create(System.Linq.Expressions.Expression`1<System.Func`2<!!0,!!1>>,!!1,Xamarin.Forms.BindingMode,Xamarin.Forms.BindableProperty/ValidateValueDelegate`1<!!1>,Xamarin.Forms.BindableProperty/BindingPropertyChangedDelegate`1<!!1>,Xamarin.Forms.BindableProperty/BindingPropertyChangingDelegate`1<!!1>,Xamarin.Forms.BindableProperty/CoerceValueDelegate`1<!!1>)' (defined in 'Xamarin.Forms.Labs, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null') from 'Xamarin.Forms.Labs, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve Xamarin.Forms.BindableProperty Xamarin.Forms.BindableProperty::Create(System.Linq.Expressions.Expression`1<System.Func`2<!!0,!!1>>,!!1,Xamarin.Forms.BindingMode,Xamarin.Forms.BindableProperty/ValidateValueDelegate`1<!!1>,Xamarin.Forms.BindableProperty/BindingPropertyChangedDelegate`1<!!1>,Xamarin.Forms.BindableProperty/BindingPropertyChangingDelegate`1<!!1>,Xamarin.Forms.BindableProperty/CoerceValueDelegate`1<!!1>)
   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.<ExecuteInstantiatedTask>d__20.MoveNext() (MSB4018) (ClubReady.Mobile.Android)

This is keeping me from being able to ship my app. Please help!
Comment 16 Vincent Poirier 2015-01-02 16:30:06 UTC
My issue was resolved, reading the error message, the issue was from OxyPlot which I removed.
Comment 17 Mike Hamilton 2015-01-02 16:44:32 UTC
Yeah my bad, I figured my issue out too. It was being caused by Xamarin.Forms.Labs.

For anyone else who might stumble on this: I updated Xamarin.Forms to 1.3.1-pre without updating Xamarin.Forms.Labs (I was on 1.2.0). For some reason, building in Debug mode worked fine, but building in Release mode killed things.

Updating to Xamarin.Forms.Labs 1.2.1-pre fixed the issue.
Comment 18 Dylan Kelly 2015-02-04 13:33:50 UTC
I am getting this issue on the xamarin-forms-samples with XF 1.3.3.6318-pre1. My minimum and target Android versions are all set for 4.4 (API 19). Prior to updating to 1.3.3-pre1, I did not experience this issue. The project builds fine for debug but fails when building on release.

13:03:33 		Build FAILED.
13:03:33 		Errors:
13:03:33 		/Users/xamarinqa/Jenkins/E5AZCY261528/xamarin-forms-samples/ButtonXaml/ButtonXaml/ButtonXaml.Android/ButtonXaml.Android.csproj (SignAndroidPackage) ->
13:03:33 		/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets (_LinkAssemblies target) ->
13:03:33 			/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Error executing task LinkAssemblies: 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.
13:03:33 			 0 Warning(s)
13:03:33 			 1 Error(s)
Comment 19 Dylan Kelly 2015-02-04 13:50:15 UTC
I've open a new Bug 26747.
Comment 21 Brendan Zagaeski (Xamarin Team, assistant) 2015-02-20 13:51:02 UTC
For anyone seeing this issue recently, the following forum post will hopefully help:
http://forums.xamarin.com/discussion/comment/104444/#Comment_104444