Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin Forms "Bundle assemblies into native code" and ofbuscation

I created Android app with Xamarin Forms. For release I use option "Bundle assemblies into native code". My apk have size - 17 Mb, without this option 33 Mb. Do I need to use obfuscation for my libraries or my code is protected? I searched a lot - but I did not find an exact answer.

like image 629
FetFrumos Avatar asked Sep 17 '17 05:09

FetFrumos


People also ask

How do I turn off fast deployment in xamarin?

Go to "Android Options" Uncheck: "Use Fast Deployment (debug mode only)"

How do you generate an .apk file from xamarin forms project using Visual Studio?

To create the APK file, right-click the Xamarin. Android project in the Solution Explorer and select Archive... This will open the Archive manager and begin archiving the project, preparing to create the APK file.


1 Answers

Bundle Assemblies into Native Code means:

When this option is enabled, assemblies are bundled into a native shared library. This option keeps your code safe; it protects managed assemblies by embedding them in native binaries.

Keep it safe :

These will bundle the .dll files into a .so file so that they are harder to tamper with on a rooted device. As BobFlora said : it will be moving IL code in with the native binaries(.so file) so it's harder for hackers to mess with it. There's no performance issue here.

Reduce apk size :

This option will reduce apk size dramatically since .so files are compressed and dlls are not.

I create an empty project, we could find the difference when use this option :

  • Didn't use Bundle Assemblies into Native Code :

enter image description here

  • Use Bundle Assemblies into Native Code :

enter image description here

Do I need to use obfuscation for my libraries or my code is protected?

It is helping increase code obfuscation (specifically on Android), and there are other ways to increase security/cryptography. If you had tighter security requirements, you could use this option, it depends on your requirement.

like image 60
York Shen Avatar answered Oct 04 '22 10:10

York Shen