Bug 23804 - [XA 4.18] Android assets included as linked files in class libraries are not copied into the final APK bundle
Summary: [XA 4.18] Android assets included as linked files in class libraries are not ...
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: 4.18.0
Hardware: PC All
: Normal normal
Target Milestone: 4.20
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2014-10-13 21:02 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2014-11-17 16:00 UTC (History)
8 users (show)

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


Attachments
Test case (22.98 KB, application/zip)
2014-10-13 21:02 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Diagnostic build output XA 4.18 (637.60 KB, text/plain)
2014-10-13 21:04 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Diagnostic build output XA 4.16 (624.43 KB, text/plain)
2014-10-13 21:04 UTC, Brendan Zagaeski (Xamarin Team, assistant)
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 Brendan Zagaeski (Xamarin Team, assistant) 2014-10-13 21:02:38 UTC
Created attachment 8404 [details]
Test case

[XA 4.18] Android assets included as linked files in class libraries are not copied into the final APK bundle.

Regression status: regression between Xamarin.Android 4.16 and 4.18.


## Steps to reproduce

1. Build the attached test case on Windows or Mac using Xamarin.Android 4.18.

The test case has 1 AndroidAsset named "Star.png" included as a linked file (using the `<Link>` element in the `.csproj` file) in the "ClassLibrary1" project.


### Mac
> xbuild /t:Build /t:SignAndroidPackage /p:Configuration=Debug AndroidApp1/AndroidApp1.csproj

### Windows
> msbuild /t:Build /t:SignAndroidPackage /p:Configuration=Debug AndroidApp1\AndroidApp1.csproj 



2. Run the app on device.



## "Bad" Result on Xamarin.Android 4.18

The app cannot find the "Star.png" asset at runtime ("Java.IO.FileNotFoundException: Star.png").

The "Star.png" asset is not copied into the `.apk` bundle:
> $ unzip -l AndroidApp1/bin/Debug/AndroidApp1.AndroidApp1.apk | grep Star\.png


## "Good" Result on Xamarin.Android 4.16

The app successfully finds the "Star.png" asset at runtime.

The asset "Star.png" _is_ copied into the `.apk` bundle:
> $ unzip -l AndroidApp1/bin/Debug/AndroidApp1.AndroidApp1.apk | grep Star\.png
>       564  10-10-14 18:53   assets/Star.png


## Partial workarounds

a. Remove "Star.png" and then re-add it as a copy so that it's present directly in the `Assets` directory instead of linked from the parent directory.

OR

b. Remove the "Star.png" asset from the "ClassLibrary1" project and add it back (either as a link or as a direct copy) to the `Assets` directory of the "AndroidApp1" app project. Make sure to set the Build Action to "AndroidAsset".



## Regression status: regression

### Good: Xamarin 4.16 (Xamarin 3.6.262 on Windows)
Xamarin   3.6.262.0 (21b7dba8736246dfd10e3f19a92ed68f1b30abfd)
Xamarin.Android   4.16.0.17 (2a7b68212b17c903160fbd8e0106babb299d1be3)
Xamarin.iOS   8.0.66.0 (3e201c8aa14879773f966f483329bcda49fd3a41)


### Bad: Xamarin 4.18 (Xamarin 3.7.203 on Windows)

Xamarin   3.7.203.0 (ff146f5240189a2ec6d3c6f75cf3967f79c79a18)
Xamarin.Android   4.18.0.34 (3b7ef0a796e8744972c48034403a6e7cb7ec189e)
Xamarin.iOS   8.2.0.0 (65b2f3a0f52f365b90ac952f0ec2e40fa0b510d4)



## Additional version information

### Mac

Mono 3.10.0 ((detached/47db868)

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


### Windows

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2014-10-13 21:04:03 UTC
Created attachment 8405 [details]
Diagnostic build output XA 4.18
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2014-10-13 21:04:26 UTC
Created attachment 8406 [details]
Diagnostic build output XA 4.16
Comment 4 Sadik Ali 2014-10-14 03:44:53 UTC
I have checked this issue and able to reproduce it with the help of bug description.

I observed that getting exception of "Java.IO.FileNotFoundException" when running attached project on XA 4.18 and able to call linked file in XA 4.16.It is regression issue.

Screencast regarding Same :
http://www.screencast.com/t/LcCqUxXg

Regression Status:

XVS         XA         Satus
3.7.201.0   4.18       Yes
3.6.253.0    4.16       No

Environment Info:
XVS 3.7.201.0
VS professional 2013 update 3
Comment 5 Jonathan Pryor 2014-10-14 11:12:04 UTC
@Eno: Could this be related to the fix for Bug #22061?
Comment 8 Atsushi Eno 2014-10-16 22:15:02 UTC
Fixed. Thanks for the repro. [master 9cf30ec]

Not sure if backport is desired at current state.
Comment 9 Jonathan Pryor 2014-10-30 14:49:30 UTC
Fixed in monodroid-4.20-series/1e817de1.
Comment 10 Saurabh 2014-11-06 08:54:37 UTC
I have checked this Issue using attached project. I am successfully able to build and run the project. Application deployed and launched on device.

Debug Output: https://gist.github.com/saurabh360/20d08683f6b96d65bbf5

XVS 3.8.113
VS 2013
X.S 5.5.4(Build 11)