Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mono for Android, code obfuscation

As everybody knows, piracy becomes a very serious issue on Android. Does Mono for Android provide code obfuscation when compiling to native code?

like image 726
Ramon Chan Avatar asked Nov 12 '12 22:11

Ramon Chan


1 Answers

Mono for Android does not provide this functionality, however you can still use a third-party tool for obfuscation. As Mono for Android produces CIL assemblies that are JITed by the Mono runtime on the Android device you need to obfuscate these .NET assemblies. Therefore tools like the Android obfuscator Proguard will not help you. The below .NET obfuscators have been reported to work with Mono for Android.

  • Xenocode Postbuild
  • CryptoObfuscator

If you use Xenocode Postbuild then make sure you disable "metadata reduction" so that Class names remain valid in Java.

Update

Xamarin.Android allows you to package APK files without the need for the compiled .NET DLLs. This means you do not need to apply obfuscation from a .NET point of view. I can extract my release APK file and find that only the classes.dex file and the .so library files are included. To enable this tick the box "Embed assemblies in native code" (this may only be available for Enterprise subscribers).

like image 99
Alex Wiese Avatar answered Oct 18 '22 07:10

Alex Wiese