Bug 20928 - LegacyBar component sample does not build against XA 4.14
Summary: LegacyBar component sample does not build against XA 4.14
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.14.0
Hardware: Macintosh Mac OS
: High blocker
Target Milestone: 4.14.0
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-06-26 19:19 UTC by Peter Collins
Modified: 2014-07-04 13:58 UTC (History)
2 users (show)

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


Attachments
repro component sample (380.31 KB, application/zip)
2014-06-26 19:19 UTC, Peter Collins
Details


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:
VERIFIED FIXED

Description Peter Collins 2014-06-26 19:19:01 UTC
Created attachment 7207 [details]
repro component sample

This is a regression from 4.12.5, the attached sample no longer builds against 4.14 / b5c14449.

Diagnostic build output:
https://gist.github.com/pjcollins/0b4b6a1f3a79948c9360

Steps to reproduce:
1. Download and unzip the attachment
2. xbuild /t:SignAndroidPackage legacybar-2.0/samples/LegacyBar/LegacyBar.Sample/LegacyBar.Sample.csproj

Environment:
OSX Mavericks
XA 4.14-series / b5c14449
Comment 1 Peter Collins 2014-06-26 19:20:36 UTC
Disregard the link to the sample in comment 0, please download from the attachments section.
Comment 2 Jonathan Pryor 2014-06-26 21:27:12 UTC
The problem caused by Bug #19748, which requests that we use `aapt --max-res-version N`, N being the API level corresponding to $(TargetFrameworkVersion), which in this case is 8:

> Tool /Users/petercollins/Library/Developer/Xamarin/android-sdk-mac_x86/build-tools/20.0.0/aapt execution started with arguments: 
> ...
>  --max-res-version 8 

This also explains the aapt warnings:

> 		max res 8, skipping menu-v11
> 		max res 8, skipping values-v11
> 		max res 8, skipping values-v14

...and the errors:

> obj/Debug/android/AndroidManifest.xml:5: error: Error: No resource found that matches the given name (at 'theme' with value '@style/MyTheme').

The MyTheme theme is only defined for API-11 and API-14:

  $ grep -rl MyTheme Resources/
  Resources//Values-v11/themes.xml
  Resources//Values-v14/themes.xml
Comment 3 Jonathan Pryor 2014-06-26 21:30:34 UTC
The question is thus, what should we do, as this is a regression from 4.12.

1. We could document the change and keep the new behavior.
2. We could revert the change.
3. We could make it "opt-in", and only specify --max-res-version if $(AndroidAaptUseMaxVersion) is True.
4. We could fix the sample, by changing $(TargetFrameworkVersion) to be >= API-11, though this introduces different errors:

> 	FragmentTabActivity.cs(100,34): error CS0104: `Fragment' is an ambiguous reference between `Android.App.Fragment' and `Android.Support.V4.App.Fragment'

Safest is probably (3), though that means yet another "knob" to control behavior and complicate our tests, so I don't particularly like that idea...

Thoughts?
Comment 4 Peter Collins 2014-06-27 12:13:56 UTC
After some deliberation, I think we'll want to go with solution #3 here.
Comment 5 Jonathan Pryor 2014-06-27 17:43:40 UTC
Fixed in monodroid/71ad690f.
Comment 6 Jonathan Pryor 2014-06-27 17:47:39 UTC
Fixed in monodroid-4.14-series/3b3333bd.
Comment 7 Jonathan Pryor 2014-06-30 22:24:03 UTC
The problem is that I misunderstood the context of the problem.

The problem isn't that `aapt --max-res-version N` is being used; this
is required in order to fix other bugs.

The problem is that the wrong N was being used! It needs to be the N
that corresponds to the android.jar that is used when invoking javac,
which starts with $(TargetFrameworkVersion) but can be OVERRIDDEN in
AndroidManifest.xml's //uses-version/@android:targetSdkVersion.

The REAL problem is that the AndroidManifest.xml override wasn't being
used to determine the target SDK version, only
$(TargetFrameworkVersion).
Comment 8 Jonathan Pryor 2014-07-01 14:25:12 UTC
Fixed in master/5809e71f and monodroid-4.14-series/c8b833b0 by using AndroidManifest.xml //uses-sdk/@android:targetSdkVersion to control the `aapt --max-res-version N` value.
Comment 9 Sunil Kumar 2014-07-04 13:58:28 UTC
We have checked this issue. Now attached sample "LegacyBar component" is building and running successfully without any error. Screencast: http://screencast.com/t/7yqZ5X7t

Environment info: 
=== Xamarin Studio ===

Version 5.2 (build 179)
Installation UUID: 561c7a69-0a91-4bae-ad7c-f0c79d594337
Runtime:
	Mono 3.6.0 ((no/5ff701f)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 306000037

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 7.2.6.17 (Business Edition)
Hash: 762ebac
Branch: 
Build date: 2014-07-03 15:53:37-0400

=== Xamarin.Android ===

Version: 4.14.0 (Business Edition)
Android SDK: /Users/tajinder/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)

=== Xamarin.Mac ===

Version:

=== Build Information ===

Release ID: 502000179
Git revision: 3dbcdf64de0826aa76b5f108ae80644511b4e587
Build date: 2014-07-03 17:37:41-04
Xamarin addins: 116ce67c67d933645f95fb370690487b18b8624e

=== Operating System ===

Mac OS X 10.8.4
Darwin Tajinders-iMac.local 12.4.2 Darwin Kernel Version 12.4.2
    Mon Jun 17 18:00:12 PDT 2013
    root:xnu-2050.45.8~1/RELEASE_X86_64 x86_64

Hence, I am closing this issue.