talsec / Free-RASP-Flutter

Flutter library for improving app security and threat monitoring on Android and iOS mobile devices.
https://github.com/talsec/Free-RASP-Community
MIT License
194 stars 20 forks source link

[Flutter project] APK file increased by 40% with FreeRASP package #100

Closed speszke closed 8 months ago

speszke commented 10 months ago

Hi, I've integrated FreeRASP package into the flutter's project and size of APK file (release build) increased from 70MB to 100MB. Is this the "price" I have to pay to use the package, or is there a way to not increase the build file's size significantly?

tompsota commented 10 months ago

Hi @speszke,

Did you increase the minSdkVersion when you installed freeRASP, or had you this dependency already satisfied? We noticed that bump from minSdkVersion API <23 to API >=23 can lead to notable increases in APK size. However, this increase is not directly caused by freeRASP: since API 23, the native libraries that come with your project are stored uncompressed in the APK (in comparison, in earlier versions, they were compressed). Although your APK might be larger, your application should load faster because the libraries are directly loaded from the APK at runtime. You can read more about it here.

In our experience, integrating freeRASP typically results in a more modest increase of around 10 MB in the APK size, as in the example app in the freeRASP project.

In your case, one potential solution to consider is to use Android App Bundle, which should result in reducing of the final app size during distribution.

Best, Tomas, Talsec developer

speszke commented 10 months ago

Hi @tompsota , Thanks for quick reply. In my case the only change increasing apk size was adding FreeRASP package - nothing else changed. I have minSdkVersion 23 already set up, so it couldn't impact the size.

tompsota commented 10 months ago

Hi @speszke,

Can you provide more information about the setup of your project? E.g. which version of Flutter and Freerasp are you using? I just tested an example app with Flutter: 3.13.9 and freerasp: 6.3.0; the increase was ~ 8 MB.

Cheers, Tomas, Talsec developer

MajdSallora commented 10 months ago

try add this in manifest in application tag android:extractNativeLibs="true"

If set to "false", your native libraries are stored uncompressed in the APK. Although your APK might be larger, your application loads faster because the libraries load directly from the APK at runtime.

Madanraj1 commented 9 months ago

@MajdSallora thanks this worked

yardexx commented 8 months ago

Hello.

I've updated Troubleshooting section in README.md. This change will be reflected in README.md at pub.dev on next update.

Issue will be closed on next freerasp release.