Bug 36456 - Building on Mac removed incorrect attrs from a resource
Summary: Building on Mac removed incorrect attrs from a resource
Status: RESOLVED INVALID
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: 6.0.0
Hardware: Macintosh Mac OS
: --- major
Target Milestone: ---
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2015-12-02 03:36 UTC by Matthew Leibowitz
Modified: 2017-11-15 19:27 UTC (History)
5 users (show)

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


Attachments
The Sample and Binding (139.43 KB, application/zip)
2015-12-02 03:36 UTC, Matthew Leibowitz
Details
A simpler test case (essentials) (49.02 KB, application/zip)
2015-12-04 21:16 UTC, Matthew Leibowitz
Details
Simpler Java test case (81.17 KB, application/zip)
2015-12-07 14:53 UTC, Matthew Leibowitz
Details

Description Matthew Leibowitz 2015-12-02 03:36:55 UTC
Created attachment 14068 [details]
The Sample and Binding

I am creating a binding, but this also happens when I add the resource to the app. What happens is that some attributes from an xml drawable resource get removed when packaging. On Windows, this does not happen.

The library that I am binding is VectorCompat. This adds a new attrs file to the app, and several attributes. A sample resource would be:

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:width="48dp"
    android:height="48dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    app:vc_viewportWidth="24"
    app:vc_viewportHeight="24" >
    <group
        android:name="rotationGroup"
        android:pivotX="12.0"
        android:pivotY="12.0"
        android:rotation="0.0">
        <path
            android:name="v"
            android:fillColor="#000000"
            android:pathData="@string/path_pause"
            app:vc_fillColor="#000000"
            app:vc_pathData="@string/path_pause"/>
    </group>
</vector>

This is stored in the "/Resources/drawable" directory, with the name "my_vector.xml". As you can see, the "viewportWidth" (and similar ones) exist twice. Once with the "android:" prefix and again with the "app:vc_" prefix. This is good, as the new build tools will remove the android one. 

On Windows, the build tools modifies this file correctly, and just removes the "android:viewportWidth" (and similar ones) attribute from the resource. It then creates a new resource, with all the attributes, in a "drawable-v21" folder. This is all correct.

On Mac, the build tools remove the wrong attributes and leave others in. In this example, it removed the "android:viewportHeight' correctly, but left the "android:viewportWidth" one in. This should have been removed. Then, it went on to also remove the "app:vc_viewportHeight" attribute as well. This should not be removed. It did create the "drawable-v21" folder and contents correctly.

I am not sure if this is a Xamarin bug as such as we are using the Google tools, but it may be... The attached case should work fine on Windows (I used the Visual Studio Android Emulator), and fail on Mac (I used the Xamarin Android Player). Both Android versions were 4.4, and I also tested on 4.1.
Comment 1 Matthew Leibowitz 2015-12-02 03:37:14 UTC
My Mac details:

=== Xamarin Studio ===

Version 5.10.1 (build 3)
Installation UUID: c9e4f285-0f71-4adb-9e10-6c574b1905a5
Runtime:
	Mono 4.2.1 (explicit/6dd2d0d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010102

=== Xamarin.Profiler ===

Version: 0.0.0.0
Location: /Applications/XamarinProfiler.Mac.app/Contents/MacOS/XamarinProfiler.Mac

=== Xamarin.Android ===

Version: 6.0.0.34 (Business Edition)
Android SDK: /Users/matthew/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3    (API level 10)
		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)
		5.1    (API level 22)
		6.0    (API level 23)

SDK Tools Version: 24.4
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.1.1 (9081)
Build 7B1005

=== Xamarin.iOS ===

Version: 9.2.1.54 (Business Edition)
Hash: eb4c1ef
Branch: master
Build date: 2015-12-01 02:12:30-0500

=== Xamarin.Mac ===

Version: 2.4.0.109 (Business Edition)

=== Build Information ===

Release ID: 510010003
Git revision: f2021a209d66d49cbc0649a6d968b29040e57807
Build date: 2015-12-01 10:43:40-05
Xamarin addins: dfd4f5103e8951edbc8ac24480b53b53c55e04ff
Build lane: monodevelop-lion-cycle6-baseline

=== Operating System ===

Mac OS X 10.10.5
Darwin Matthew-Mac.mshome.net 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 2 Matthew Leibowitz 2015-12-02 03:38:23 UTC
My Windows details:

=== Xamarin Studio ===

Version 5.10 (build 871)
Installation UUID: f5f091b2-c47f-4cdd-9c2f-576a1398d1a7
Runtime:
	Microsoft .NET 4.0.30319.42000
	GTK+ 2.24.23 (MS-Windows theme)
	GTK# 2.12.30

=== Xamarin.Profiler ===

Version: 0.22.0.0
Location: C:\Program Files (x86)\Xamarin\Profiler\XamarinProfiler.exe

=== Xamarin.Android ===

Version: 6.0.0 (Business Edition)
Android SDK: C:\ProgramData\Android\android-sdk
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 24.3.4

SDK Platform Tools Version: 23.0.1

SDK Build Tools Version: 23.0.1


Java SDK: C:\Program Files\Java\jdk1.7.0_79
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

=== Xamarin Android Player ===

Not Installed

=== Build Information ===

Release ID: 510000871
Git revision: 4e9c5abb5ffdae12ba02ac49da83f8b2011dbb88
Build date: 2015-11-12 07:16:34-05
Xamarin addins: 55007ed0e56436f385d8e26394a45be563abc7e8
Build lane: monodevelop-windows-cycle6

=== Operating System ===

Windows 10.0.10586.0 (64-bit)
Comment 3 Matthew Leibowitz 2015-12-04 21:16:49 UTC
Created attachment 14130 [details]
A simpler test case (essentials)

Mac output (XS):

  JellyBean (v16):
    dp, height, width, viewportWidth, test_viewportWidth, name, pivotX, pivotY, rotation, pathData, app, http, schemas, android, com, apk, res, auto, android, http, schemas, android, com, apk, res, android, vector, group, rotationGroup, path
    Contains 'viewportWidth': True
    Contains 'viewportHeight': False
    Contains 'test_viewportWidth': True
    Contains 'test_viewportHeight': False

  Lollipop (v22):
    dmv, height, width, viewportHeight, viewportWidth, test_viewportHeight, test_viewportWidth, name, pivotX, pivotY, rotation, fillColor, pathData, app, http, schemas, android, com, apk, res, auto, android, http, schemas, android, com, apk, res, android, vector, group, rotationGroup, path
    Contains 'viewportWidth': True
    Contains 'viewportHeight': True
    Contains 'test_viewportWidth': True
    Contains 'test_viewportHeight': True

Windows output (VS and XS):
  JellyBean (v17):
    CLU, height, width, test_viewportHeight, test_viewportWidth, name, pivotX, pivotY, rotation, app, http, schemas, android, com, apk, res, auto, android, http, schemas, android, com, apk, res, android, vector, group, rotationGroup, path
    Contains 'viewportWidth': False
    Contains 'viewportHeight': False
    Contains 'test_viewportWidth': True
    Contains 'test_viewportHeight': True
 
  Lollipop (v22):
    dmv, height, width, viewportHeight, viewportWidth, test_viewportHeight, test_viewportWidth, name, pivotX, pivotY, rotation, fillColor, pathData, app, http, schemas, android, com, apk, res, auto, android, http, schemas, android, com, apk, res, android, vector, group, rotationGroup, path
    Contains 'viewportWidth': True
    Contains 'viewportHeight': True
    Contains 'test_viewportWidth': True
    Contains 'test_viewportHeight': True
Comment 4 Matthew Leibowitz 2015-12-07 14:53:06 UTC
Created attachment 14147 [details]
Simpler Java test case

I can confirm that this bug does not exist in Java:

  Jellybean:
    T, d, CLU, j, height, width, test_viewportHeight, test_viewportWidth, name, pivotX, pivotY, rotation, android, http, schemas, android, com, apk, res, android, app, http, schemas, android, com, apk, res, auto, vector, group, rotationGroup, path, v, U, Y, t, D, D, t, C, C, B
    Contains 'viewportWidth': false
    Contains 'viewportHeight': false
    Contains 'test_viewportWidth': true
    Contains 'test_viewportHeight': true

  Lollipop:
    x, H, dmv, height, width, viewportHeight, viewportWidth, test_viewportHeight, test_viewportWidth, name, pivotX, pivotY, rotation, fillColor, pathData, android, http, schemas, android, com, apk, res, android, app, http, schemas, android, com, apk, res, auto, vector, group, rotationGroup, path, v, M, l, z, U, Y, D, D, D, D, t, C, C, B
    Contains 'viewportWidth': true
    Contains 'viewportHeight': true
    Contains 'test_viewportWidth': true
    Contains 'test_viewportHeight': true
Comment 5 Sadik Ali 2016-01-15 06:22:23 UTC
I have checked this issue with latest C6SR1 XA build mono-android-6.0.1-5_50280e429258764f86de88655b579991041ffb59.pkg and able to reproduce with API 22 and  unable to reproduce it with API 16 on Samsung Nexus S(1) device. 
Could you please provide Device Details,Environment Info to reproduce this issue. 


Screencast(API 16): http://www.screencast.com/t/np7fGf3ZHr

Application Output(API 16): https://gist.github.com/Arpit360/a1c319cb71f7befae37b

Screencast(API 22): http://www.screencast.com/t/uUcpUaOl4

Application Output(API 22): https://gist.github.com/Arpit360/a3f372026028b7be2ad7


Environment info: 
=== Xamarin Studio ===

Version 5.10.2 (build 51)
Installation UUID: 5aee9e7c-04d2-4896-b80a-a918340ae634
Runtime:
	Mono 4.2.2 (explicit/9236711)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402020025

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: 6.0.1.5 (Business Edition)
Android SDK: /Users/360_macmini/Desktop/setup/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		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)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.1
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.3 (10130.10)
Build 7D111g

=== Xamarin.iOS ===

Version: 9.4.1.15 (Business Edition)
Hash: 28b1990
Branch: master
Build date: 2016-01-04 17:34:31-0500

=== Xamarin.Mac ===

Version: 2.5.0.3130 (Business Edition)

=== Build Information ===

Release ID: 510020051
Git revision: 36453d5e06a1ad2cc8d261ad32e29abe0ed57c1f
Build date: 2016-01-12 17:33:10-05
Xamarin addins: ab25321e8918350655a7d46c86cfbaac3222fd3c
Build lane: monodevelop-lion-cycle6-c6sr1

=== Operating System ===

Mac OS X 10.11.2
Darwin 360-MACMINIs-Mac-mini-2.local 15.2.0 Darwin Kernel Version 15.2.0
    Fri Nov 13 19:56:56 PST 2015
    root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64
Comment 6 Matthew Leibowitz 2016-01-28 14:56:47 UTC
Unfortunately, I do not have physical device with a lower Android version, but this doesn't seem to be device related as the value is missing from the package itself. I am using the Xamarin Android Player v0.6.5. That seems to be the only difference.

My environment is:

Xamarin Studio
Version 5.10.2 (build 55)
Installation UUID: c9e4f285-0f71-4adb-9e10-6c574b1905a5
Runtime:
	Mono 4.2.2 (explicit/996df3c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402020030

Xamarin.Profiler
Version: 0.0.0.0
Location: /Applications/XamarinProfiler.Mac.app/Contents/MacOS/XamarinProfiler.Mac

Apple Developer Tools
Xcode 7.2 (9548)
Build 7C68

Xamarin.Mac
Version: 2.4.1.6 (Business Edition)

Xamarin.Android
Version: 6.0.1.9 (Business Edition)
Android SDK: /Users/matthew/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3    (API level 10)
		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)
		5.1    (API level 22)
		6.0    (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Xamarin Android Player
Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

Xamarin.iOS
Version: 9.4.1.24 (Business Edition)
Hash: 47eb74b4
Branch: master
Build date: 2016-01-20 17:06:01-0500

Build Information
Release ID: 510020055
Git revision: 7c95611a8097853826b8ee411887a1f88cf83add
Build date: 2016-01-19 22:23:27-05
Xamarin addins: 9816bee7ff5ab3845ef51354dc687010422beb68
Build lane: monodevelop-lion-cycle6-c6sr1

Operating System
Mac OS X 10.10.5
Darwin Matthew-Mac.local 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 7 Jon Douglas [MSFT] 2017-11-15 19:27:49 UTC
I am marking this bug as RESOLVED INVALID given that this behavior no longer exhibits with current Android or Xamarin.Android tooling. Perhaps this was a bug in build tools or similar on Mac that has since been fixed. I am seeing the following:

API 16:

    Contains 'viewportWidth': false
    Contains 'viewportHeight': false
    Contains 'test_viewportWidth': true
    Contains 'test_viewportHeight': true

API 22:

    Contains 'viewportWidth': true
    Contains 'viewportHeight': true
    Contains 'test_viewportWidth': true
    Contains 'test_viewportHeight': true

This exhibits the expected behavior in Java and thus I believe this is invalid now. 

Tested on v26 of Android tools across the board

Note You need to log in before you can comment on or make changes to this bug.