Closed christophechateau closed 3 days ago
For information, i found a workaround by targeting after ILLink (so just before the AOT in Release mode) :
Target
<Target Name="ObfuscarReleaseAll" AfterTargets="ILLink" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Message Text="start obfuscate for all $(MonoAndroidIntermediateAssetsDir)..\..\linked\" Importance="High" />
<Exec WorkingDirectory="$(MonoAndroidIntermediateAssetsDir)..\..\linked\" Command="$(Obfuscar) $(ProjectDir)obfuscar_dll_arch.xml" />
<Copy SourceFiles="$(MonoAndroidIntermediateAssetsDir)..\..\linked\Obfuscator_Output\myAssembly.dll" DestinationFolder="$(MonoAndroidIntermediateAssetsDir)..\..\linked\" />
<Message Text="end obfuscate for all $(MonoAndroidIntermediateAssetsDir)..\..\linked\" Importance="High" />
</Target>
Obfuscar
<?xml version='1.0'?>
<Obfuscator>
<Var name="InPath" value="." />
<Var name="OutPath" value="$(InPath)\Obfuscator_Output" />
<Var name="KeepPublicApi" value="true" />
<Var name="HidePrivateApi" value="true" />
<Var name="SuppressIldasm" value="false" />
<Var name="AnalyzeXaml" value="false" />
<Var name="HideStrings" value="false" />
<Var name="UseUnicodeNames" value="false" />
<Var name="RenameProperties" value="false" />
<Var name="RenameFields" value="false" />
<Var name="RenameEvents" value="false" />
<Module file="$(InPath)\myAssembly.dll" />
</Obfuscator>
Android framework version
net8.0-android
Affected platform version
NET8
Description
Hi,
I'm trying to obfuscate the IL Code in the APK/ABB with obfuscar. Its configuration for the old
Xamarin.Form
no longer works with the newdotnet/android
.Basicaly, obfuscar takes a dll as input and ouput the obfuscate version of the dll.
I've already read about same other thread, extended entrypoint and assembly store.
Unfortunately, i don't find any entry point where i can obfuscate my dll and then its packed into the APK/AAB. On each of my test, the local dll are obfuscated but when i decompress the final APK/AAB there are still not.
At least,
myAssembly.dll
is located in many paths :obj\Release\net8.0-android\myAssembly.dll
obj\Release\net8.0-android\android-arm\linked\myAssembly.dll
obj\Release\net8.0-android\android-arm64\linked\myAssembly.dll
obj\Release\net8.0-android\android-x86\linked\myAssembly.dll
obj\Release\net8.0-android\android-x64\linked\myAssembly.dll
bin\Release\net8.0-android\myAssembly.dll
But also in a .so version which i presume is really packed in the APK/AAB :
obj\Release\net8.0-android\android-arm\linked\myAssembly.dll.so
obj\Release\net8.0-android\android-arm64\linked\myAssembly.dll.so
obj\Release\net8.0-android\android-x86\linked\myAssembly.dll.so
obj\Release\net8.0-android\android-x64\linked\myAssembly.dll.so
A little help about the build process (ie: the dll to .so transformation...) could help me to find where i can hook the obfuscation step.
Very thanks.
Steps to Reproduce
add obfuscar
insert new target
obfuscar_dll.xml