Bug 22079 - Android project builds fine in Debug mode but errs out in Release mode
Summary: Android project builds fine in Debug mode but errs out in Release mode
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.2
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Seth Rosetter
URL:
Depends on:
Blocks:
 
Reported: 2014-08-13 16:27 UTC by Rob DeRosa
Modified: 2015-06-08 20:49 UTC (History)
6 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 ANSWERED

Description Rob DeRosa 2014-08-13 16:27:17 UTC
I've included a link to a project that builds fine in Debug mode but errs out when Release is the selected mode. It appears that the ActivityIndicator binding causes the error since when I comment out that specific line, it compiles in Release mode.

TripExpenses Android project can be found here: https://www.dropbox.com/s/pwnoaujziznpuvu/TripExpenses%202.zip

The lines of code that seems to cause the error is on line 57 and 58 of ExpensePage.cs

activity.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
activity.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");

When these lines are commented out, the project compiles for both Debug and Release modes.

Error: /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 Xamarin.Forms.BindableObjectExtensions::SetBinding(Xamarin.Forms.BindableObject,Xamarin.Forms.BindableProperty,System.String,Xamarin.Forms.BindingMode,Xamarin.Forms.IValueConverter,System.String)' (defined in 'TripExpenses.Core, Version=1.0.5338.24174, Culture=neutral, PublicKeyToken=null') from 'TripExpenses.Core, Version=1.0.5338.24174, Culture=neutral, PublicKeyToken=null' could not be resolved. (TripExpenses.Android)


Xamarin.Forms version: 1.2.2.6243


My System Info:

=== Xamarin Studio ===

Version 5.2.1 (build 1)
Installation UUID: 2bd781aa-d369-471a-9df8-19f8c9e01fb2
Runtime:
	Mono 3.6.0 ((no/f540f8a)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 306000039

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 7.2.6.28 (Enterprise Edition)
Hash: 606f31a
Branch: 
Build date: 2014-08-01 15:27:48-0400

=== Xamarin.Android ===

Version: 4.14.0 (Enterprise Edition)
Android SDK: /Users/Rob/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		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)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Xamarin.Mac ===

Version:

=== Build Information ===

Release ID: 502010001
Git revision: d06832ce9807d6be24aca225457e8b37c7669f6f
Build date: 2014-08-07 12:10:47-04
Xamarin addins: 1de032531be4cecf2f39dbee3b87aac78204058c

=== Operating System ===

Mac OS X 10.9.4
Darwin Robs-MacBook-Pro.local 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Comment 1 Rajneesh Kumar 2014-08-14 04:52:15 UTC
I have checked this issue and able to reproduce this with the help provide in bug description. I observed that  when I build the attached sample project in “Debug” mode the build gets successfull, but when I Change the mode to “Release” and build again then I am getting the following exception:

/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 Xamarin.Forms.BindableObjectExtensions::SetBinding(Xamarin.Forms.BindableObject,Xamarin.Forms.BindableProperty,System.String,Xamarin.Forms.BindingMode,Xamarin.Forms.IValueConverter,System.String)' (defined in 'TripExpenses.Core, Version=1.0.5339.25462, Culture=neutral, PublicKeyToken=null') from 'TripExpenses.Core, Version=1.0.5339.25462, Culture=neutral, PublicKeyToken=null' could not be resolved. (TripExpenses.Android)

I also observed that when I  comment on the Following line In ExpensesPage.cs  code:(Line No 56, 57)
                                activity.SetBinding(ActivityIndicator.IsRunningProperty,"IsBusy");
		activity.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");

The build gets successfully, without any error in the “Relese” mode.


Screencast: http://www.screencast.com/t/FtGJmJZYx

Environment Info:

=== Xamarin Studio ===

Version 5.2 (build 386)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
	Mono 3.8.0 ((no/1a2c721)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 308000004

=== Xamarin.Android ===

Version: 4.14.0 (Enterprise Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
	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)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 7.4.0.97 (Enterprise Edition)
Hash: 1400f0f
Branch: 
Build date: 2014-08-12 20:42:33-0400

=== Xamarin.Mac ===

Version: 1.10.0.4 (Enterprise Edition)

=== Build Information ===

Release ID: 502000386
Git revision: e6a54dee5376e6e7a2d9982695b060fddc09e65d
Build date: 2014-08-04 14:03:28-04
Xamarin addins: 2b5a5c26ac2ee74c6e91a8d24ef44d0ca9cb74d0

=== Operating System ===

Mac OS X 10.9.2
Darwin MacMini.local 13.1.0 Darwin Kernel Version 13.1.0
    Thu Jan 16 19:40:37 PST 2014
    root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2014-09-24 16:28:04 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 3 Stephane Delcroix 2015-06-02 03:23:24 UTC
I suspect an issue with some of your code being linked away, but can't reproduce as the link for the application is dead.

Could you please attach a sample to this issue ? Thanks.
Comment 4 Rajneesh Kumar 2015-06-08 11:33:30 UTC
Hi....

Here is the link for the sample: https://www.dropbox.com/s/wdjuov6uxdr54ys/TripExpenses.zip?dl=0

This was provided in the bug description. And I was able to reproduce this issue using this sample.

Thanks..!
Comment 5 Seth Rosetter 2015-06-08 20:49:24 UTC
The article below should resolve your build error. Also, when testing this solution, I tested targeting latest Xamarin.Forms stable (1.4.2). 

https://kb.xamarin.com/customer/portal/articles/1902736-why-does-my-android-build-fail-with-error-executing-task-linkassemblies-error-xa2006-

One thing to note, 14 no longer shows up as a minimum target , however, targeting API level 15 should do the trick.