Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

r8 vs. dotufuscator for xamarin android

After far more hours googling than I care to admit, I hope that someone can give me a clear steer on whether I should be using r8, dotfuscator CE or neither for code obfuscation!

I am currently building an app (yes, my first) under Xamarin Android (Visual Studio 2019). Google recommend r8 for code obfuscation prior to releasing an app on the Play Store. Looking into how to do this under Xamarin Android, I came across dotfuscator, which seemed to be the tool more closely integrated with Visual Studio. I have tried both alternatives, but without success so far. Rather than waste a lot more time on getting something to work which won't ultimately do what I need, I wonder if someone could point me in the right direction. I cannot get a clear view on whether I should be pursuing r8 or Dotfuscator - or neither. Various articles seem to contradict one another, but the reason for that might be that some of them are outdated. A lot seems to be happening in this area right now.

Here is where I am at the moment: I followed the installation instructions on the PreEmptive website and built my app with Dotfuscator, but it crashed during loading. (It was previously working.) I then tried r8. It crashed at first, but after changing the configuration to exclude one of the AppCompat libraries, my app built and ran fine. However, looking at the compiled code with ILSpy, all my classes, methods, etc. were clear to see. r8 had certainly not done what I had expected. I did find an article which stated that r8 only obfuscated java code, not C#. Is this the case? If so, then I am probably wasting my time pursuing r8 and I should probably return to Dotfuscator and put some effort into getting that working.

I would really appreciated some advice with this. I know there must be someone out there who understands the issues! Thank you!!

Jutta

Best Answer

Answers

  • JuttaJutta Member ✭✭

    A heartfelt "thank you" to you, Graham, for giving me such a clear and to-the-point answer. I really, really appreciate it. I have wasted so much time trying to figure out what each of the tools does and doesn't do. I suspect I'll stumble across some issues as I stride out, but at least I know which direction to go in now, which makes a huge difference. Thanks so much for your help!

Sign In or Register to comment.