Bug 23924 - Default Android designer rendering API level does not match Target framework
Summary: Default Android designer rendering API level does not match Target framework
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Designer ()
Version: 5.5
Hardware: PC All
: --- enhancement
Target Milestone: ---
Assignee: Jérémie Laval
URL:
: 23814 ()
Depends on:
Blocks:
 
Reported: 2014-10-19 20:26 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2015-02-27 12:32 UTC (History)
4 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:
VERIFIED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2014-10-19 20:26:52 UTC
Default Android designer rendering API level does not match Target framework

This enhancement request is partly motivated by bug 22713, where users who have Android 4.4W installed will currently see an error in the designer when they first open any layout that contains an `EditText`. The workaround in that case is to switch the designer rendering API to a lower version. In general it might be nice to have the designer automatically select the API level that matches the "Target framework" or maybe the "Target Android version" when it first opens a layout.


## Steps to reproduce

1. Create a new "C# -> Android -> Android Application" solution.

2. Open the project options: "Project -> $(MSBuildProjectName) Options".

3. Set "Build -> General -> Target framework" to "Android 4.0.3 (Ice Cream Sandwich)".

4. Click "OK" in the bottom right of the window to save the new settings.

5. In the solution pad, double-click "Main.axml" to open it in the Android designer.


## Result
By default, the Android designer renders the layout using the highest Android API version installed rather than the version selected in step 3 (Android 4.0.3).


## Desired result
The Android designer renders the layout using the version selected in step 3 (Android 4.0.3). Another option might be use the "Build -> Android Application -> Target Android version". I'm not sure which way would be more consistent with the rest of the build + development experience.

I think:

- "Target framework" specifies the version of the Xamarin.Android bindings that is used for C# autocomplete and compilation.

- "Target Android version" specifies the version of `android.jar` that is used when performing the Java phase of compilation.


## Work around
Manually change the designer rendering API level to match the "Target framework" from step 3.


## Version information

Xamarin Studio Version 5.5.2 (build 3)
Release ID: 505020003
Git revision: 6d4c806e383ba366b15fbccca9ddc1ba94f8d5ad
Build date: 2014-10-15 15:00:36-04
Xamarin addins: 069ddd29bb70a42238142eee9bac21a5e4b2f9f9

Mono 3.10.0 ((detached/e204655)
GTK+ 2.24.23 (Raleigh theme)

Xamarin.Android 4.18.0 (Business Edition)
Android SDK: /Users/macuser/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		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)
		4.4.87 (API level 20)

Android SDK Tools 23.0.5
Android SDK Platform-tools 21
Android SDK Build-tools 21
Android SDK Build-tools 20

Java SDK: /Users/macuser
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)

Mac OS X 10.9.5


Thanks!
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2014-10-19 20:41:16 UTC
*** Bug 23814 has been marked as a duplicate of this bug. ***
Comment 3 Jeremy Kolb 2014-10-19 22:49:18 UTC
As 23814 says this also affects Visual Studio.  The designer definitely needs some love.
Comment 5 Sunil Kumar 2015-02-27 12:32:56 UTC
I have checked this issue followed by the steps mentioned in bug description and now this issue works fine. The Android designer renders the layout using the version selected as Target Framework.

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

Environment info: 
=== Xamarin Studio ===

Version 5.7.2 (build 8)
Installation UUID: 561c7a69-0a91-4bae-ad7c-f0c79d594337
Runtime:
	Mono 3.12.0 ((detached/b8f5055)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000077

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 8.6.2.26 (Business Edition)
Hash: 9905782
Branch: 
Build date: 2015-02-26 11:05:07-0500

=== Xamarin.Android ===

Version: 4.20.0.28 (Trial 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)
		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)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.Mac ===

Version: 1.10.0.18 (Business Edition)

=== Build Information ===

Release ID: 507020008
Git revision: 64a4266f0a82f7558472383d8ae66a526b3b881d
Build date: 2015-02-25 11:22:12-05
Xamarin addins: 1cb443ca2dddd9933d748e035560f06cf9c246bd

=== 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