Bug 34548 - Broken dependency chain when embedding wear applications
Summary: Broken dependency chain when embedding wear applications
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 5.1
Hardware: PC Mac OS
: High normal
Target Milestone: 6.0 (C6)
Assignee: dean.ellis
Depends on:
Reported: 2015-10-04 11:00 UTC by Jérémie Laval
Modified: 2015-11-13 16:26 UTC (History)
3 users (show)

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:

Description Jérémie Laval 2015-10-04 11:00:58 UTC
When an Android application is embedding a wear app through Project reference, there is an issue with PrepareWearApplicationFiles that mistakenly think that it needs to rewrite wearable_app_desc.xml

The reason is that the file is generated from a verbatim string containing new lines. When the file is then handed out to the resources crunching tasks later on in the build, those new lines are stripped away.

The problem is that on the next run this means that the check in place `File.ReadAllText (intermediateXmlFile) != xml` will fail and thus re-gen the file causing the resources build to incorrectly run again because the file is now newer than the rest.
Comment 3 Peter Collins 2015-10-06 10:14:24 UTC
Moving to 6.0 milestone for consideration. Marking as RESOLVED | FIXED as per Comment #2.
Comment 4 dean.ellis 2015-10-06 10:16:14 UTC

Its not fixed yet. the PR is up for master but no merged.
Comment 5 Peter Collins 2015-10-06 10:30:49 UTC
Fair enough, though in my mind it's still valid as a fix attempt does exist (and could even be built and tested).
Comment 6 dean.ellis 2015-10-06 11:02:01 UTC
Fixed in monodroid/master/38071593
Comment 7 Arpit Jha 2015-10-13 06:54:03 UTC
I have checked this issue and able to reproduce this issue with the help of bug description 

Steps I have followed to reproduce this issue :
1.Create a Xamarin.Android App.
2.Create a wear app in same solution.
3.Add reference of wear project to Android app project.
4.Build the android app.

Observed that a wearable_app_desc.xml file created  at and getting build error /Users/mac360_xamarin/Projects/App701/App701/obj/Release/res/xml

I have checked the same  able to reproduce with Cycle 6 build mono-android-6.0.0-13_4f0d1e9e7fd59c4c57046c9077c277180c2f5a8d observed that Getting a build error.

I have also checked this issue with mono-android-4.20.1-0_ac29b2c637a39bbc3eb8da672fa95d7b06918058 and its working fine.

As per comment  https://bugzilla.xamarin.com/show_bug.cgi?id=34548#c6 I have checked this issue with latest master mono-android-6.0.99-87_839c5d47d50c0bc08bb3bfa7e248446bf0bb76ea and observed that issue still exist.
Please let me know the correct build on which issue has been fixed.

As of Now I am Reopening this issue.

Build output: https://gist.github.com/Arpit360/67a24774f74eb31f2612
Screencast: http://www.screencast.com/t/DvE7y1uMqq

Environment Info:
=== Xamarin Studio ===

Version 5.10 (build 815)
Installation UUID: 3d25a767-a003-4a7d-9f5e-e57987cf6cf0
	Mono 4.2.1 (explicit/d8b68fd)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010069

=== Xamarin.Profiler ===

Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/mac360_xamarin/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		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

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.1
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.0 (8227)
Build 7A220

=== Xamarin.Mac ===

Version: (Business Edition)

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 3e5d608
Branch: master
Build date: 2015-10-09 16:01:44-0400

=== Build Information ===

Release ID: 510000815
Git revision: 1f1910169d5433415cac632094c57272080ef9df
Build date: 2015-10-08 14:39:26-04
Xamarin addins: a44901897f3e0c6a25c0f12b6a5fcd892faecdbc
Build lane: monodevelop-lion-cycle6

=== Operating System ===

Mac OS X 10.10.5
Darwin mac360-xamarins-Mac-mini.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 8 dean.ellis 2015-10-13 07:14:48 UTC
The bug isn't that the wearable_app_desc.xml its that is SHOULDN'T be re-generated on a second build (because it didn't change).

the error you get is because your new wear app package name does not match the main app package name (you need to change that manually) and its NOT a bug its a problem in your app/wear app. 

So steps to confirm its fixed

1.Create a Xamarin.Android App.
2.Create a wear app in same solution.
3.Add reference of wear project to Android app project.
4. Change wear app package name to match main app (this will fix the "error" )
5.Build the android app.
6. Confirm wearable_app_desc.xml is created (on disk and in the build log)
7. Build the android app again
8. Confirm wearable_app_desc.xml is NOT changed (i,e "Created additional resource as obj/Debug/res/xml/wearable_app_desc.xml" should NOT appear in the output).
Comment 9 Arpit Jha 2015-10-13 07:57:22 UTC
Thanks  @Dean,  I have checked this issue again with latest master
mono-android-6.0.99-87_839c5d47d50c0bc08bb3bfa7e248446bf0bb76ea and followed the steps mentioned in https://bugzilla.xamarin.com/show_bug.cgi?id=34548#c8 

Observation : I observed that on build android app fist time wearable_app_desc.xml created at obj/Debug/res/xml/wearable_app_desc.xml on first build and wearable_app_desc.xml is displaying in build output and on building android app again wearable_app_desc.xml not displaying in build output.

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

Build output:
On first time: https://gist.github.com/Arpit360/319782914b6b141b1fde
Second Time:  https://gist.github.com/Arpit360/a573725bbb0633b52cc9

As per bug milestone is C6, I  will verify this issue when patch will merge in cycle 6.
Comment 10 Peter Collins 2015-11-13 16:26:37 UTC
This is verified fixed in monodorid/cycle6/3efa14c4