Bug 7946 - Mono for Android 4.2.8 unable to build with android-support-v4
Summary: Mono for Android 4.2.8 unable to build with android-support-v4
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: 4.2.x
Hardware: PC Windows
: High normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
: 7978 ()
Depends on:
Blocks:
 
Reported: 2012-10-23 09:38 UTC by Patrick
Modified: 2014-09-08 17:52 UTC (History)
17 users (show)

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


Attachments
Sample project were bug appears (16.08 KB, application/zip)
2013-04-11 12:08 UTC, Mikhail
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:
RESOLVED FIXED

Description Patrick 2012-10-23 09:38:25 UTC
After upgrading to Mono for Android 4.2.8, I can't build my project that has reference to android-support-v4.jar anymore.

I will receive this error during build:
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(3,3): Error: You have Jar libraries, android-support-v4.jar, that have the identical name with inconsistent file contents. Please make sure to remove any conflicting libraries in EmbeddedJar, InputJar and AndroidJavaLibrary. (Support4)


I have followed the instructions from the following guideline
http://docs.xamarin.com/Android/Guides/Platform_Features/Fragments/Part_4_-_Providing_Backwards_Compatibility_with_the_Android_Support_Package


Even the sample from Xamarin is getting the same error.
https://github.com/xamarin/monodroid-samples/tree/master/Support4



This bug is definitely related to this new feature in the release
- Binding Projects now embed the bound .jar into the binding assembly.
http://docs.xamarin.com/android/Releases/Mono_For_Android_4/Mono_for_Android_4.2.8
Comment 1 Atsushi Eno 2012-10-23 10:47:07 UTC
This is not a bug but explicitly designed behavior. We should NOT remove whatever users specified *arbitrarily*. That rather brings confusion to users and it should be always user who decide which to leave into app package and which to discard.

To make it clear, when the jars, one in the dll and others in app projects, are IDENTICAL (which means both have identical name *and* identical content), they don't result in conflict. For any *other* cases, you should be *aware* that the jar is *inconsistent* with the actual jar which is being used in the application.

You are seeing the error message because you use *inconsistent* support-v4 jar.

EmbeddedJar feature is not specific to Mono.Android.Support.v4.dll. Any user bindings fall into the same *possibly conflicting* situation. You will get furious if we arbitrarily determine that "your jar in the application is extraneous" while it might be *newer* (!) especially in such scenario like this: the application also uses newer jar as AndroidJavaLibrary to invoke new API feature, and it fails be cause we silently drop the newer jar due to this *wrong* assumption.

Of course there is no deterministic way to identify *which* library is actually newer, and there is no chance to actually use the application jar if you have to stick to the dll, which is not *always* true - users could use different binding dll.

We made the error message very clear to indicate what to do: you have to either alter the dll or remove the application jar (or any conflicting jar in other dll).

Hence the current behavior is the only way to assure valid jar packaging. Regardless of whether we embed the jar into the dll or not in this version, such possibly-mismatching jar-vs-dll issue could have happened, so cancelling EmbedJar is worse choice.

Hope this explanation makes sense.
Comment 2 Patrick 2012-10-23 21:14:36 UTC
Hi Atsushi Eno,

Thank you for the explanation on this. I have updated the support package from Android SDK Manager and replaced the one from the Xamarin's Support4 sample project.

May I ask if I should still continue to reference the android-support-v4.jar in the SupportLib folder? or I can safely remove that?

Now the project can compile in *Debug* configuration but if I try to compile the project in *Release* configuration, I get this error instead. (see below)

I've made some tests and this error will only appear if I make use of classes from Mono.Android.Support.v4, such as FragmentActivity.

I'm not sure if it is related or not. If it's not, kindly let me know if I should log a new bug for this. Apologies if I should not have reopened this bug.

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

C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(5,5): Error MSB4018: The "LinkAssemblies" task failed unexpectedly.

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
   at Mono.Collections.Generic.Collection`1.get_Item(Int32 index)
   at Mono.Cecil.Mdb.MdbReader.ReadLocalVariables(MethodEntry entry, MethodBody body, Scope[] scopes)
   at Mono.Cecil.Mdb.MdbReader.Read(MethodBody body, InstructionMapper mapper)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.MethodDefinition.<get_Body>b__2(MethodDefinition method, MetadataReader reader)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
   at Mono.Cecil.MethodDefinition.get_Body()
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) (MSB4018) (Support4)
Comment 3 Patrick 2012-10-23 22:48:38 UTC
Hi,

I made a mistake earlier when I replaced the android-support-v4.jar file. I did not reset the Build Action to AndroidJavaLibrary, and it was set to None.

After resetting the Build Action, I still get the same error saying that the library is inconsistent.

How is it possible for us to know what version of the library the Mono.Android.Support.V4.dll is currently using as we did not build the dll by ourselves?

Thanks
Comment 4 Atsushi Eno 2012-10-24 02:37:44 UTC
Duncan: can you make sure that we have the latest android support packages on the package build machine?

Patrick: all the jars should be extracted to {your_project}/obj/Debug/__library_projects__ directory.
Comment 5 Patrick 2012-10-24 02:55:46 UTC
Hi Atsushi Eno,

Thanks again. I can now build properly in Debug after copying the jar from the folder back to the SupportLib folder, but Release still throws the same issue.

C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(5,5): Error MSB4018: The "LinkAssemblies" task failed unexpectedly.

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
   at Mono.Collections.Generic.Collection`1.get_Item(Int32 index)
   at Mono.Cecil.Mdb.MdbReader.ReadLocalVariables(MethodEntry entry, MethodBody body, Scope[] scopes)
   at Mono.Cecil.Mdb.MdbReader.Read(MethodBody body, InstructionMapper mapper)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.MethodDefinition.<get_Body>b__2(MethodDefinition method, MetadataReader reader)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
   at Mono.Cecil.MethodDefinition.get_Body()
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) (MSB4018) (Support4)
Comment 6 Atsushi Eno 2012-10-24 14:54:43 UTC
Yes, I could reproduce this issue with 4.2.8 (took a while to verify this with 4.2.8). It's fixed in our development master so it will go away at some stage, but I'll see if I could fix it in 4.2 series.
Comment 7 Atsushi Eno 2012-10-24 14:55:32 UTC
And I forgot to answer to your question: yes you can safely remove android-support-v4.jar from your project.
Comment 8 Atsushi Eno 2012-10-25 00:01:48 UTC
*** Bug 7978 has been marked as a duplicate of this bug. ***
Comment 9 Atsushi Eno 2012-10-25 04:38:13 UTC
This Cecil crasher should be fixed in the final 4.2.8 release. Thanks for the report.

[4.2 2f79f57]
Comment 10 Atsushi Eno 2012-10-25 04:38:59 UTC
oops, I shouldn't have closed the bug, the support-v4.jar issue still remains. Duncan?
Comment 11 zaller 2012-11-07 10:14:55 UTC
Any info on when the 4.2.9 will come out we are running into the same error and it is quit annoying  

Error	33	The "LinkAssemblies" task failed unexpectedly.
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Comment 14 Timur Gilfanov 2012-12-10 05:46:40 UTC
I just update from 4.2.8 to 4.4.41 in beta channel and this fixes ArgumentOutOfRangeException issue for me.
Comment 15 Yuri 2012-12-11 02:15:57 UTC
I have the same fault. But i've used already 4.4.41 in the stable release.
Comment 16 David Hoffmann 2012-12-11 02:38:59 UTC
I have the same problem on my mac.


MonoDevelop 3.0.5
Installation UUID: 3edb3c8b-1034-4172-8801-66a34af0f1c2
Runtime:
	Mono 2.10.9 (tarball)
	GTK 2.24.10
	GTK# (2.12.0.0)
	Package version: 210090011
Apple Developer Tools:
	 Xcode 4.5.2 (1847)
	 Build 4G2008a
Monotouch: 6.0.6
Mono for Android: 4.4.41
Android SDK: /Users/hoffmann/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		1.6   (API level 4)
		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)
Java SDK: /usr
Build information:
	Release ID: 30005000
	Git revision: e159cf083bd327933166819d94245298898d6e3d
	Build date: 2012-10-24 16:43:06+0000
	Xamarin addins: eea2ed91ae8dd242b281d5ec8f6c2fbc63b4cd3d
Operating System:
	Mac OS X 10.7.5
	Darwin 11.4.2 Darwin Kernel Version 11.4.2
	    Thu Aug 23 16:25:48 PDT 2012
	    root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
Comment 17 Kevin McMahon 2013-01-31 17:12:34 UTC
Any traction/movement on this?  Would like to update and get some of the other fixes but not being able to do release builds and package up said builds is a show stopper for us and our client.

Thanks,
Kevin
Comment 18 Chilaxx 2013-04-10 10:44:21 UTC
I'm also having this problem with version 4.6.02001. Can't build in Release because of the Linking - Sdk Only. This was working perfectly a few weeks back (don't know which version I was using back then).

I just tested to see if it's not anything in code that I changed by loading up a branch of our first public release and I'm getting the same problem...
Comment 19 jilani 2013-04-11 09:42:42 UTC
I'm also having the same problem even after updating Xamarin Android to version 4.6.2. Is there any workaround for this?

=== Xamarin Studio ===

Version 4.0.3 (build 13)

Installation UUID: 970cd0fb-221d-4cca-a768-6db49b1475c9

Runtime:

	Microsoft .NET 4.0.30319.17929

	GTK 2.24.13

	GTK# (2.12.0.0)

=== Xamarin.Android ===

Version: 4.6.2 (Business Edition)

Android SDK: C:\Program Files (x86)\Android\android-sdk

	Supported Android versions:

		2.1   (API level 7)

		2.2   (API level 8)

		2.3   (API level 10)

		3.1   (API level 12)

		4.0   (API level 14)

		4.0.3 (API level 15)

Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39

=== Build Information ===

Release ID: 400030013

fae7c2bde0e8d51943fbd6afa22d7d2bb7a1192f

Build date: 2013-03-21 15:53:00Z

Xamarin addins: 906a1edff23bcfd0ab7518463620a8ee506eaea2

=== Operating System ===

Windows 6.1.7601.65536 (64-bit)
Comment 20 Mikhail 2013-04-11 12:00:36 UTC
I think it is not surprising but I also has the same issue.
Yesterday I've downloaded new version of Xamarin.Android wich was 4.6.2. When I tried to build my project wich correctly worked in previous versions (<4.6) now I get the following error:


(sorry it's in Russian)

Ошибка	1	непредвиденная ошибка при выполнении задачи "LinkAssemblies".
System.ArgumentOutOfRangeException: Заданный аргумент находится вне диапазона допустимых значений.
   в Mono.Collections.Generic.Collection`1.get_Item(Int32 index)
   в Mono.Cecil.Mdb.MdbReader.ReadLocalVariables(MethodEntry entry, MethodBody body, Scope[] scopes)
   в Mono.Cecil.Mdb.MdbReader.Read(MethodBody body, InstructionMapper mapper)
   в Mono.Cecil.Cil.CodeReader.ReadMethodBody()
   в Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   в Mono.Cecil.MethodDefinition.<get_Body>b__2(MethodDefinition method, MetadataReader reader)
   в Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
   в Mono.Cecil.MethodDefinition.get_Body()
   в Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   в Mono.Linker.Steps.MarkStep.ProcessQueue()
   в Mono.Linker.Steps.MarkStep.Process()
   в Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   в Mono.Linker.Pipeline.Process(LinkContext context)
   в MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   в Xamarin.Android.Tasks.LinkAssemblies.Execute()
   в Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   в Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()	AndroidApplication7


I've spent a lot of time on trying to understand this bug and found that  the bug appears when (both):
1. using Android.Support.V4 lib
2. building with linking mode set to Full

So, I think this is the Linker bug connected with Support Library. No matter what class or namespace of Android.Support.V4 is used the bug appears instantly.

Trying to make things clear I've made a sample project with one FragmentActivity and one DialogFragment nothing else. And I've reproduced this issue on it!

I want to know is there weither temporary or instant solution to this breaking issue? This is very important, cause this freezes our development process.

My sample poject is in attachment.
Comment 21 Mikhail 2013-04-11 12:08:24 UTC
Created attachment 3800 [details]
Sample project were bug appears

 I get the following error:


(sorry it's in Russian)

Ошибка	1	непредвиденная ошибка при выполнении задачи "LinkAssemblies".
System.ArgumentOutOfRangeException: Заданный аргумент находится вне диапазона допустимых значений.
   в Mono.Collections.Generic.Collection`1.get_Item(Int32 index)
   в Mono.Cecil.Mdb.MdbReader.ReadLocalVariables(MethodEntry entry, MethodBody body, Scope[] scopes)
   в Mono.Cecil.Mdb.MdbReader.Read(MethodBody body, InstructionMapper mapper)
   в Mono.Cecil.Cil.CodeReader.ReadMethodBody()
   в Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   в Mono.Cecil.MethodDefinition.<get_Body>b__2(MethodDefinition method, MetadataReader reader)
   в Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
   в Mono.Cecil.MethodDefinition.get_Body()
   в Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   в Mono.Linker.Steps.MarkStep.ProcessQueue()
   в Mono.Linker.Steps.MarkStep.Process()
   в Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   в Mono.Linker.Pipeline.Process(LinkContext context)
   в MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   в Xamarin.Android.Tasks.LinkAssemblies.Execute()

In Xamarin.Android 4.6.2 appears when (both):
1. using Android.Support.V4 lib
2. building with linking mode set to Full
Comment 22 Peter Hultqvist 2013-04-12 03:21:24 UTC
I'm on the stable channel and got the same error:

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(5,5): Error MSB4018: The "LinkAssemblies" task failed unexpectedly.
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
   at Mono.Collections.Generic.Collection`1.get_Item(Int32 index)
   at Mono.Cecil.Mdb.MdbReader.ReadLocalVariables(MethodEntry entry, MethodBody body, Scope[] scopes)
   at Mono.Cecil.Mdb.MdbReader.Read(MethodBody body, InstructionMapper mapper)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.MethodDefinition.<get_Body>b__2(MethodDefinition method, MetadataReader reader)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
   at Mono.Cecil.MethodDefinition.get_Body()
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() (MSB4018) (MUR-Status)
Comment 23 Yuri 2013-04-12 04:15:14 UTC
I have the same Error (sorry its german)


C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(5,5): Error MSB4018: Unerwarteter Fehler bei der LinkAssemblies-Aufgabe.

System.ArgumentOutOfRangeException: Das angegebene Argument liegt außerhalb des gültigen Wertebereichs.

   bei Mono.Collections.Generic.Collection`1.get_Item(Int32 index)

   bei Mono.Cecil.Mdb.MdbReader.ReadLocalVariables(MethodEntry entry, MethodBody body, Scope[] scopes)

   bei Mono.Cecil.Mdb.MdbReader.Read(MethodBody body, InstructionMapper mapper)

   bei Mono.Cecil.Cil.CodeReader.ReadMethodBody()

   bei Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)

   bei Mono.Cecil.MethodDefinition.<get_Body>b__2(MethodDefinition method, MetadataReader reader)

   bei Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)

   bei Mono.Cecil.MethodDefinition.get_Body()

   bei Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)

   bei Mono.Linker.Steps.MarkStep.ProcessQueue()

   bei Mono.Linker.Steps.MarkStep.Process()

   bei Mono.Linker.Steps.MarkStep.Process(LinkContext context)

   bei Mono.Linker.Pipeline.Process(LinkContext context)

   bei MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)

   bei Xamarin.Android.Tasks.LinkAssemblies.Execute()

   bei Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()

   bei Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() (MSB4018) (TestRelease)
Comment 24 Yuri 2013-04-12 04:17:35 UTC
And this error came using Mono.Android.Support.v4 in 
class Activity : FragmentActivity. 
Any ideas? Workaround?
Comment 25 Peter Hultqvist 2013-04-15 05:41:49 UTC
Since the Xamarin.Android upgrade to 4.6.7 today the bug does no longer occur for me.
Comment 26 Kevin McMahon 2013-04-18 12:39:19 UTC
After having this issue disappear for a while it is back for me as well with Xamarin Studio 4.0.3 and now 4.0.4 (as shown below w/ all the other relevant info).

=== Xamarin Studio ===

Version 4.0.4 (build 2)
Installation UUID: a6667dfd-08aa-4ad3-9ab8-280525076696
Runtime:
	Mono 2.10.12 (mono-2-10/c9b270d)
	GTK 2.24.16
	GTK# (2.12.0.0)
	Package version: 210120000

=== Apple Developer Tools ===

Xcode 4.6.1 (2067)
Build 4H512

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Xamarin.Android ===

Version: 4.6.2 (Enterprise Edition)
Android SDK: /Users/kevin/developer/android
	Supported Android versions:
		1.6   (API level 4)
		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)
Java SDK: /usr

=== Xamarin.iOS ===

Version: 6.2.3.0 (Enterprise Edition)
Hash: 8d98f5e
Branch: 
Build date: 2013-10-04 14:08:06-0400

=== Build Information ===

Release ID: 400040002
Git revision: a8bf58d398a13bcc7595f5f85adae04865a834d4
Build date: 2013-04-17 16:35:47+0000
Xamarin addins: f24db65837464cb72995ce5e84fa62fb0069724c

=== Operating System ===

Mac OS X 10.8.3
Darwin kmcmahon-mbp 12.3.0 Darwin Kernel Version 12.3.0
    Sun Jan  6 22:37:10 PST 2013
    root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
Comment 27 Kevin McMahon 2013-04-18 13:52:29 UTC
To follow up. I wasn't seeing updates in the Stable channel for Xamarin.Android and I was on Version: 4.6.2 (Enterprise Edition). When and redownloaded the Xamarin Installer via my account on the website and updated to Xamarin 4.6.4. I know that Peter Hultqvist just reported that he is having issues with Xamarin.Android 4.6.7 so i guess YMMV.
Comment 28 Jonathan Pryor 2014-01-14 15:36:10 UTC
Does this happen for anyone on a post-Xamarin.Android 4.8 release?

Furthermore, as of this point in time you should prefer the Component over the bundled assembly, as it contains a more up-to-date binding:

http://components.xamarin.com/view/xamandroidsupportv4-18
Comment 29 Dylan 2014-09-08 14:40:52 UTC
I'm also experiencing this issue. Running Xamarin.Android 4.16.0.

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(3,3): Error: You have Jar libraries, classes.jar, that have the identical name with inconsistent file contents. Please make sure to remove any conflicting libraries in EmbeddedJar, InputJar and AndroidJavaLibrary.
Comment 30 Jonathan Pryor 2014-09-08 15:29:18 UTC
This was originally By Design, I believe to avoid accidental double inclusion. When using dx.jar to compile .class files into a .dex file, there is an implicit requirement that there be no duplicate files, i.e. there can be only one android.support.v4.util.TimeUtils type included from ANY .jar file. The assumption was that .jar filenames would be unique, and thus if we prevented inclusion of more than one android-support-v4.jar file, we would prevent duplication inclusion of all the types included within that .jar file, hence the report in Comment #0, which was a GOOD THING:

> Error: You have Jar libraries, android-support-v4.jar, that have the identical 
> name with inconsistent file contents. 

If we didn't generate that error, then instead of a "reasonable" error message of "don't include two different versions of android-support-v4.jar", we'd instead generate an error message from dx.jar stating that the type android/support/v4/util/TimeUtils.class was found twice.

(Rephrased: this is a plausible error condition; the question was how best to handle & report it.)

The problem with classes.jar is that it's the *default* name used by many Java toolchains, and thus requiring a unique filename for classes.jar tends to cause more pain than gain.

The filename uniqueness check for classes.jar is disabled in monodroid/f53f25ec -- meaning your app can have more than one classes.jar -- but keep in mind that this re-introduces the possibility of errors later in the build process that may be harder to understand.
Comment 31 Dylan 2014-09-08 15:42:55 UTC
Solution build perfectly before installing latest stable updates to Android 4.16.0. After update I receive that error. Cleaned solution. Not sure where to go from here.


Happened on two of my developer's machines now after they updated.
Comment 32 Jonathan Pryor 2014-09-08 16:26:15 UTC
@Eno: Any idea why things would have worked prior to 4.20? See Comment #31.
Comment 33 Dylan 2014-09-08 17:23:57 UTC
Is there a work-around in the mean time? Productivity has kind of ground to a halt...
Comment 34 Jonathan Pryor 2014-09-08 17:44:20 UTC
@Dylan: In the meantime....why does your app have two different classes.jar files? Do you have any Binding projects which bind classes.jar? Could you rename classes.jar to something else?
Comment 35 Dylan 2014-09-08 17:52:25 UTC
I honestly have no idea why there would be more than one. First time I have ever heard of a classes.jar file. 

It appears as though there are two classes.jar in the obj folder for the same project - one for Xamarin.Facebook and one for GooglePlayServices. These must have always been there though?