question

nnovalbos-6961 avatar image
0 Votes"
nnovalbos-6961 asked LeonLu-MSFT commented

Error archiving an obfuscated app

I am trying to obfuscate the android apk from visual, with the obfuscator library, following the following manual: https://docs.obfuscar.com/tutorials/xamarin.html

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)" />
  </Target>


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:

 <Obfuscator>
     <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" />
 </Obfuscator>

Thanks

dotnet-xamarinforms
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Please try to set inPath and outPath set an absolute path instead of a relative path.

0 Votes 0 ·

Same result...

i'm in visual studio for mac, but i didn't read anywhere that i had to do anything extra.

0 Votes 0 ·

You can move your project to the VS for windows. then refer to this thread to do it :https://devblogs.microsoft.com/xamarin/protecting-xamarin-apps-dotfuscator/#how-to-obfuscate-your-app

0 Votes 0 ·

0 Answers