Protecting the code

As Android app packages are just ZIP files that contain the assemblies and metadata, the assemblies can easily be decompiled. As a result, we need a way to make it very difficult to understand the decompiled code, or even prevent it from happening altogether.

Getting ready

In this recipe, we will make use of the Babel for .NET obfuscator (https://babelfor.net/products/obfuscator). This is a commercial product, but they do have a demo version that can be used for free. The demo version does have a few limitations, and the obfuscated apps only run for a period of time, however this does not prevent us from using it.

There aren't many Mac/Linux obfuscators for .NET, and Babel for .NET is no different. We will also need a Windows ...

Get Xamarin Mobile Development for Android Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.