Error archiving an obfuscated app

nnovalbos 371 Reputation points

I am trying to obfuscate the android apk from visual, with the obfuscator library, following the following manual:

I have added the following post compilation action in my android csproj file:

<Target Name = "AfterBuild" Condition = "'$ (Configuration)' == 'Release'">
    <Exec WorkingDirectory = "$ (MonoAndroidIntermediateAssetsDir)" Command = "'$ (Obfuscate)' $ (ProjectDir) obfuscar.xml" />
    <Copy SourceFiles = "$ (TargetDir) name.Android.dll" DestinationFolder = "$ (MonoAndroidIntermediateAssetsDir)" />
    <Copy SourceFiles = "$ (TargetDir) name.Core.dll" DestinationFolder = "$ (MonoAndroidIntermediateAssetsDir)" />

When I compile in release it seems to work, but when I try to archive the app it gives me the following error:

Error MSB3073: The command "mono Obfuscar.Console.exe '/obfuscar.xml" exited with code 1. (MSB3073)

my obfuscar.xml file is:

    <Var name="RenameProperties" value="true" />
    <Var name="RenameEvents" value="true" />
    <Var name="RenameFields" value="true" />
    <Var name="KeepPublicApi" value="true" />
    <Var name="HidePrivateApi" value="true" />
    <Var name="HideStrings" value="true" />
    <Var name="UseUnicodeNames" value="true" />
    <Var name="OptimizeMethods" value="true" />
    <Var name="InPath" value="../name.Android/bin/Release" />
    <Var name="OutPath" value="$(InPath)/Obfuscator_Output" />
    <Module file="name.Android.dll" />
    <Module file="name.Core.dll" />


A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,001 questions
{count} votes