Matt,

The only problem I had with obfuscation was that some class or identifier
names were OK in .NET but the obfuscated name wasn't valid in Java. This
caused a problem at the packaging stage. It could be that there's something
in the second assembly that surfaces this problem.

In my case (using Xenocode) there was an option to disable "metadata
reduction" - the identifier names became more straightforward and were valid
in both C# and Java.

Andy

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Matt
Sent: 26 April 2012 03:29
To: [email protected]
Subject: [mono-android] Linking problem with obfuscated assembly

I am having a couple different problems linking my assemblies after they are
obfuscated. I have two library assemblies and the main application assembly,
all of which are compiled for Mono for Android. If I obfuscate only the
first library assembly, I am able to link and build my apk without any
problems. If I obfuscate the second, assembly, I get the following error
during linking:

[msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:
The "LinkAssemblies" task failed unexpectedly. 
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:
System.ArgumentOutOfRangeException: Specified argument was out of the range
of valid values. 
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Collections.Generic.Collection`1.get_Item(Int32 index)
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Cecil.SignatureReader.GetGenericParameter(GenericParameterType type,
UInt32 var)
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Cecil.SignatureReader.ReadTypeSignature(ElementType etype)
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Cecil.MetadataReader.GetTypeSpecification(UInt32 rid)
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Cecil.MetadataReader.LookupToken(MetadataToken token)
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Cecil.Cil.CodeReader.ReadOperand(Instruction instruction)
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Cecil.Cil.CodeReader.ReadCode()
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Cecil.Cil.CodeReader.ReadFatMethod()
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Cecil.MethodDefinition.<get_Body>m__34(MethodDefinition method,
MetadataReader reader)
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Cecil.MethodDefinition.get_Body()
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Linker.Steps.MarkStep.ProcessQueue()
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Linker.Steps.MarkStep.Process()
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Mono.Linker.Pipeline.Process(LinkContext context)
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext&
context)
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at Xamarin.Android.Tasks.LinkAssemblies.Execute()
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at
Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecu
tionHost.Execute()
  [msbuild] C:\Program Files
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(547,5): error MSB4018:

at
Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHo
st
taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost,
ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
  [msbuild] Done executing task "LinkAssemblies" -- FAILED.


I am calling msbuild from nant, and my build process goes something like
this:

1. msbuild target="Build" 
2. obfuscate all assemblies
3. msbuild target="SignAndroidPackage"
4. zipalign package

The SignAndroidPackage target is the task that fails. Any ideas why? 

If I skip obfuscation of the second assembly, the linking process succeeds,
but I have another problem. The SignAndroidPackage target appears to rebuild
the assembly for my main application, because the assembly that gets added
to the apk is not obfuscated. Am I calling the correct build targets in the
correct order?

Thanks,
Matt

--
View this message in context:
http://mono-for-android.1047100.n5.nabble.com/Linking-problem-with-obfuscate
d-assembly-tp5666519p5666519.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to