Bug 24612 - Referencing a library project's resources with upper case letters in filenames does not work
Summary: Referencing a library project's resources with upper case letters in filename...
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.18.1
Hardware: PC Mac OS
: Normal normal
Target Milestone: 5.1
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2014-11-18 10:06 UTC by James Athey
Modified: 2015-05-11 09:53 UTC (History)
5 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 James Athey 2014-11-18 10:06:57 UTC
If I create a resource with a mixed-case filename (e.g., "Icon_Settings.png"), and put it in an Android Library project, I can reference that resource without a problem from within that Library project. (I assume that __res_name_case_map.txt makes this work.)

However, Android layout XML files in an application project that depends on that library project cannot use the mixed-case resource. In this example, when I try to build, aapt fails with the following error message:

Tool exited with code: 1. Output:
    obj/Debug/res/layout/settings_view_logout.xml:1: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/Icon_Settings').

Renaming the resource to all lower-case fixes the issue. The workaround is less than ideal, because renaming files only by changing the case can cause problems with source control and case-preserving filesystems (like NTFS).

Other relevant details:

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

=== Xamarin Studio ===

Version 5.5.3 (build 6)
Installation UUID: 59b6da8f-a4f1-4f53-af41-a2755ed262c2
Runtime:
	Mono 3.10.0 ((detached/e204655)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000023

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.Mac ===

Version:

=== Xamarin.Android ===

Version: 4.18.1 (Business Edition)
Android SDK: /opt/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
Java SDK: /usr
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

=== Xamarin.iOS ===

Not Installed

=== Build Information ===

Release ID: 505030006
Git revision: fbe3e9453daf6a3bb9a9709ed22bec35f7c9056b
Build date: 2014-10-23 13:08:38-04
Xamarin addins: e44add2b39de4dd57c0742bb2e620dfad84c64c6

=== Operating System ===

Mac OS X 10.9.5
Darwin machine.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 1 Abhishek 2014-12-08 06:16:28 UTC
I have tried reproduce this issue at my end but I am unable to reproduce it. I have tried followings:

I have created library project and added Icon_Settings.png in the resources and use that library in the android application and able to build and run this application successfully.

Screencast: http://screencast.com/t/O1dU2zqKo

I have checked this issue with XA 4.20.0.28 & XA 4.18.1.3 and unable to reproduce this issue with both builds.

Please let me know if I have missed any step. 

Please check this issue with latest and if you are still getting same behavior then please attach following with bug:
1. Sample project(if possible)
2. Build output
3. IDE log (Help-> Open Log directory)


Build Info:

Android SDK info:

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

******************************

=== Xamarin Studio ===

Version 5.5.3 (build 6)
Installation UUID: 93e693b0-b53d-40f4-b29c-b61ff5cbe892
Runtime:
	Mono 3.10.0 ((detached/92c4884)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000031

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.iOS ===

Version: 8.4.0.43 (Trial Edition)
Hash: 840a925
Branch: 
Build date: 2014-11-16 21:03:22-0500

=== Xamarin.Android ===

Version: 4.18.1 (Trial Edition)
Android SDK: /Users/xamarin23/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)
		4.4.87 (API level 20)
		4.5    (API level 21)
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.Mac ===

Version: 1.10.0.18 (Trial Edition)

=== Build Information ===

Release ID: 505030006
Git revision: fbe3e9453daf6a3bb9a9709ed22bec35f7c9056b
Build date: 2014-10-23 13:08:38-04
Xamarin addins: e44add2b39de4dd57c0742bb2e620dfad84c64c6

=== Operating System ===

Mac OS X 10.10.0
Darwin xamarin23s-Mac-mini.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 2 James Athey 2014-12-08 11:47:32 UTC
The issue is that Android _layout XML_ files cannot see the mixed case drawable. Your example references the drawable in a C# attribute on the MainActivity class.

In the main layout XML, add an ImageView that uses the library project's drawable.
Comment 3 Abhishek 2014-12-08 13:24:15 UTC
Thanks @James for yours suggestion.

I have added an ImageView control and when I set the src of ImageView by library project's drawable then I am getting same error:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Tool exited with code: 1. Output: obj/Debug/res/layout/main.xml:1: error: Error: No resource found that matches the given name (at 'src' with value '@android:drawable/Icon_Settings').

Build Output: https://gist.github.com/Abhishekk360/448dde33bd722d00858c
Comment 4 dean.ellis 2015-01-21 05:06:49 UTC
I have replicated this bug. While you can use the lower cased version icon_setting you currently cannot use the normal case Icon_Setting. I'm looking into this now
Comment 5 dean.ellis 2015-01-21 06:58:41 UTC
I found the issue. When fixing up the resource cases in layout files we scan the resource directory to make sure the item exists (e.g a drawable) before trying to fix it up. In this case the drawable didn't exist in the same directory structure as the layout file so it was not lower cased as it should be.
Comment 6 dean.ellis 2015-01-23 10:16:12 UTC
Fixed in monodroid/master/37deac14
Comment 7 domen 2015-01-26 21:03:46 UTC
I'm not sure if fix resolves the following issue I have, but I would like to mention it anyway because it's not identical:

Image TEMP_image.png can be normally included in any layout (with attribute android:src="..." on ImageView element), but when it's referenced from Resources/values/Styles.xml, compiler complains that it could not be found. If I rename image to temp_image.png, everything works as it should.

Error:
No resource found that matches the given name (at 'android:src' with value '@drawable/TEMP_image').


My Xamarin version data:

Xamarin Studio
Version 5.7 (build 661)
Installation UUID: 59a6b98a-f16f-4f0a-9aa9-e5192209be89
Runtime:
	Microsoft .NET 4.0.30319.34209
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.26

Xamarin.Android
Version: 4.20.0 (Indie Edition)
Android SDK: [...]
	Supported Android versions:
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: [...]
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)

Build Information
Release ID: 507000661
Git revision: b70bab61da996da29045ea8ee8aed1a6faedbe78
Build date: 2015-01-05 11:27:37-05
Xamarin addins: 82f6c71490562d6cd125a09287f441902fdac3d7
Comment 8 Rajneesh Kumar 2015-05-05 07:37:52 UTC
I have checked this issue with the following builds:

Xamarin Studio Version 5.9 (build 464)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
Mono 4.0.1 ((detached/5a0b19f)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400010024
Apple Developer Tools Xcode 6.2 (6770)
Build 6C121
Xamarin.iOS
Version: 8.10.1.24 (Enterprise Edition)
Hash: 1b48440
Branch: master
Build date: 2015-05-04 17:01:32-0400
Xamarin.Android Version: 5.1.0.129 (Enterprise Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
=== Build Information ===
Release ID: 509000464
Git revision: 97f3c43266a4abe2dff0a31b1afb976de897d099
Build date: 2015-05-04 10:06:54-04
Xamarin addins: 438f3e4b8352e006958552de07c6f54770c9233c
=== Operating System ===
Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
 Sun Aug 17 19:50:11 PDT 2014
 root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64

I observed that this issue working fine. Now, Referencing a library project's resources with upper case letters in filenames works properly.
Here is the screencast for the same: http://www.screencast.com/t/m9W3s6AQ

This issue has been fixed hence I am closing this issue.

Thanks..!
Comment 9 domen 2015-05-08 19:14:27 UTC
Issue is still not fixed when referencing file from Styles.xml.

Steps to reproduce:
* Add image UPPER_image.png to Resources/drawable.
* Change content of Resources/values/Styles.xml to:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
      <style name="stylename">
        <item name="android:background">@drawable/UPPER_image</item>
      </style>
    </resources>

* Build project.
* Error "Error APT0000: No resource found that matches the given name (at 'android:background' with value '@drawable/UPPER_image'). (APT0000)" will appear. But it should not.
Comment 10 Rajneesh Kumar 2015-05-11 09:53:33 UTC
As the initial issue "Referencing a library project's resources with upper case letters in filenames works properly." has been fixed. 

And as per comment 9 "Issue is still not fixed when referencing file from Styles.xml."  I also able to reproduce this issue, So, I have filed separate issue for this .

https://bugzilla.xamarin.com/show_bug.cgi?id=29939

Thanks..!