Bug 36183

Summary: Since upgrading to Xamarin Android 6 get error error MSB3733: Input file "obj\Android\Debug\android\AndroidManifest.xml" cannot be opened
Product: Android Reporter: jason
Component: MSBuildAssignee: dean.ellis
Severity: normal CC: abhishekk, bpn, chris.pont, Daniel.Regner, dmarier, jkells, joe, jon.douglas, jonp, kumpera, kzu, manuel.lachberger, mono-bugs+bugzilla, mono-bugs+monodroid, peter.collins, pgulotta, prchol
Priority: High    
Version: 6.0.0   
Target Milestone: 6.1 (C7)   
Hardware: PC   
OS: Windows   
Tags: _XVS1215 Is this bug a regression?: ---
Last known good build:
Bug Depends on:    
Bug Blocks: 38638    
Attachments: Simple solution that reproduces the issue

Description jason 2015-11-23 18:50:14 UTC
I upgraded to Xamarin ANdroid 6 this morning. I can no longer build our Android project from Visual Studio. I get a bunch of errors like the following:

>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Analysis.targets(43,2): error MSB3733: Input file "obj\Android\Debug\android\AndroidManifest.xml" cannot be opened. Could not find a part of the path 'C:\Users\jason\Documents\code\criticalarc\Source\Libraries\Core\obj\Android\Debug\android\AndroidManifest.xml'.

5>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Analysis.targets(43,2): error MSB3733: Input file "obj\Android\Debug\android\AndroidManifest.xml" cannot be opened. Could not find a part of the path 'C:\Users\jason\Documents\code\criticalarc\Dependencies\Intrinsic\Source\Libraries\Core\obj\Android\Debug\android\AndroidManifest.xml'.

Platform details:
Windows 10
Visual Studio 2015

=== Xamarin Studio ===

Version 5.10 (build 871)
Installation UUID: b869ac57-6046-4852-9973-745466356a21
	Microsoft .NET 4.0.30319.42000
	GTK+ 2.24.23 (MS-Windows theme)
	GTK# 2.12.30

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: 6.0.0 (Business Edition)
Android SDK: C:\Users\jason\AppData\Local\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.4

SDK Platform Tools Version: 23.0.1

SDK Build Tools Version: 23.0.1

Java SDK: C:\Program Files (x86)\Java\jdk1.7.0_71
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)

=== 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.10240.0 (64-bit)
Comment 1 Daniel R. Regner 2015-11-23 21:54:19 UTC
I get the same error on class library projects referenced by an Android app.

Turning-off code analysis successfully works-around the issue as well as tampering with the Xamarin.Android.Analysis.targets MSBuild file to not look for the nonexistent AndroidManifest.xml file in library projects.

29>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Analysis.targets(43,2): error MSB3733: Input file "obj\Android\Debug\android\AndroidManifest.xml" cannot be opened. Could not find a part of the path 'C:\TFS\Research\DRR\Systems\TELS\Offline Asset Upload\Messaging\Forms\obj\Android\Debug\android\AndroidManifest.xml'.
Comment 2 Jose Gallardo 2015-12-03 15:06:11 UTC
Moving the bug to the Xamarin Android product, as it's an issue on the build targets there.
This way the Android team can track it.

Thanks for reporting!

JonP/Dean: Please feel free to ping us if you need anything else from our side.

Comment 4 Peter Collins 2015-12-15 15:41:27 UTC
@Jason / @Daniel is there any chance you could provide a project which reproduces this behavior?

Also if possible please attach full diagnostic msbuild output[0], as this will likely provide more insight into why this error is being thrown

[0] https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Diagnostic_MSBuild_Output
Comment 5 Jared Kells 2015-12-15 23:52:30 UTC
Created attachment 14307 [details]
Simple solution that reproduces the issue

This solution reproduces the issue.
Comment 6 Daniel R. Regner 2015-12-15 23:54:46 UTC
Thanks for posting the repro!  You beat me to it.  :)
Comment 7 Jared Kells 2015-12-16 00:10:54 UTC
It's a default Xamarin Android project with a default class library added.
It will immediately fail if you try to run code analysis but I've also added the following to the project file so code analysis is run on build.

Comment 8 dean.ellis 2015-12-16 14:29:43 UTC
I have replicated this issue :)
Comment 9 dean.ellis 2015-12-17 11:25:35 UTC
This problem is the Analysis Target is running but the SignAndroidPackage target has not been so the required files are not in place.. 

Investigating why the SignAndroidPackage target is not running.
Comment 10 bpn 2016-01-13 10:18:31 UTC
I had success whith downgrading to Xamarin.VisualStudio_3.11.1589 to make my builds work again. Of course downgrading might break other stuff but until xamarin resolves this is one way to work around the issue.
Comment 11 dean.ellis 2016-01-13 10:26:21 UTC
The work around for now is to disable CodeAnalysis on the Android project


That should work until we can fix the test to actually run the SignAndroidPackage target
Comment 12 Mikayla Hutchinson [MSFT] 2016-01-15 21:14:28 UTC
*** Bug 37669 has been marked as a duplicate of this bug. ***
Comment 13 dean.ellis 2016-01-22 12:53:43 UTC
Fix in monodriod/master/14640e3a

This will fix this issue on Windows. For a Mac fix we still need to wait for the mono bump which includes XmlPeek which was committed in mono/master/86522f62.
Comment 14 Peter Collins 2016-02-03 19:25:36 UTC
@Dean Could we put up a PR for this for inclusion in mono 4.3.2? If/when that's accepted, let's bump monodroid to point to that.
Comment 15 Jonathan Pryor 2016-02-08 16:26:14 UTC
I find Comment #13 and Comment #14 somewhat confusing, because mono/master/86522f62 dates to November 26, 2015, and was merged to master on December 1, 2015 (commit mono/40d516ff), and (as per `git log origin/mono-4.3.2-branch`) mono/40d516ff is already part of mono-4.3.2-branch.

The XmlPeek commit is *not* in mono-4.2.0-branch, nor in mono-4.3.1-branch or mono-4.3.0-branch.

What *system mono* is slated for Cycle 7?
Comment 16 Peter Collins 2016-02-10 15:43:34 UTC
As far as I know, mono-4.3.2 is the mono that will be shipping everywhere.
Comment 17 Rodrigo Kumpera 2016-02-10 22:35:32 UTC
Hey Dean,

You didn't correctly implement XmlPeek. It's missing registration in in the appropriate .tasks files[1].

[1] Files like mcs/tools/xbuild/data/*/Microsoft.Common.tasks
Comment 18 dean.ellis 2016-02-11 10:18:05 UTC
A PR has been submitted for this mono/pull/2598
Comment 19 dean.ellis 2016-02-12 11:25:05 UTC
Fixed in mono/master/96cd1c9e9f

Cheery picked to mono/mono-4.3.2-branch/17fda960
Comment 20 Abhishek 2016-03-02 14:14:30 UTC
I am able to reproduce this issue at my end both on Mac and Windows XS, VS.

build Output Windows XS: https://gist.github.com/Abhishekk360/fc3030d076bb050e0bde
Builld Output Windows VS: https://gist.github.com/Abhishekk360/ceddbdbb4539fe9d80f6

While reproducing this issue on Mac XS getting "Error initializing task XmlPeek"
build Output Mac XS: https://gist.github.com/Abhishekk360/131fe2b65f86dcadbd2b

To Verify this issue, I have checked this issue with the latest master build and C7 mono.


The attached sample is working fine. I am successfully able to build the application on VS 2015.

Build Output: https://gist.githubusercontent.com/Abhishekk360/cec509452b2aac2706dc/raw/bf4c94d11fae90b0e1de34c987d1d4fa2223504b/build%2520output
Screencast: http://www.screencast.com/t/1E0ehhRmU

Windows XS:

Build Output: https://gist.github.com/Abhishekk360/ffa130438c018a38e6a9
Screencast: http://www.screencast.com/t/YFkfjmcU

Mac XS:

Build Output: https://gist.github.com/Abhishekk360/c70dd71cb048c5608772.
Comment 21 Abhishek 2016-03-30 14:44:28 UTC
I have checked this issue with the latest C7 build both Mac and Windows Environment

Mac Environment


Screencast: http://www.screencast.com/t/lrFohIhAaJV
Build Output: https://gist.github.com/Abhishekk360/068cf394f6b97f8ad4c579f9b88c5c91

Windows Environment


Screencast for XS: http://www.screencast.com/t/tDloW1XqY
Build Output for XS: https://gist.github.com/Abhishekk360/10016a871152cc0214076e450d65630e

Screencast for VS: http://www.screencast.com/t/1mppE32jH
Build Output for VS: https://gist.githubusercontent.com/Abhishekk360/59e5a682ff01ffe59306813de5cffbe6/raw/77a5a7ffab4602a0c1c70e4397d2c0bf6931d87b/build%2520output%2520vs