fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.
https://fzyzcjy.github.io/flutter_rust_bridge/
MIT License
4.29k stars 300 forks source link

How to build ios binary small like in other platforms? #2287

Closed tinyc0der closed 2 months ago

tinyc0der commented 2 months ago

I'm trying to build a wrapper for similar library for flutter. I also config build tool for it like your document. Everything work well but the binary in ios is larger (>16MB) than other platforms (<1M). Can you help me what am I doing wrong? Thanks

This is my repo https://github.com/CoryApp/similar_flutter

welcome[bot] commented 2 months ago

Hi! Thanks for opening your first issue here! :smile:

fzyzcjy commented 2 months ago

Firstly, what is your method to check ios binary size? IIRC there are many sizes, some are not the ones that will be downloaded (s.t. we do not need to worry)

tinyc0der commented 2 months ago

@fzyzcjy I check them in the asset of a release https://github.com/CoryApp/similar_flutter/releases/tag/precompiled_abba3d7ecfa2645441a2f40100ca15d4

image
fzyzcjy commented 2 months ago

The .a file is static lib, which means, even if it is 100MB, if you only use 1MB of it in your app, it will only make your app +1MB size. On the other hand, .so file is dynamic lib, so if it is 100MB then your app size +100MB.

(The real case is a bit more complex, you also need to consider compression, so a 1MB .so file may only make your apk about 0.3MB larger, for example)

tinyc0der commented 2 months ago

static lib for ios ( about 16MB ) confused me. I will research it more. Thanks

fzyzcjy commented 2 months ago

You are welcome!

github-actions[bot] commented 1 month ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.