Closed sumanthratna closed 1 month ago
Maybe the SDK can support better tree-shaking? For us, we primarily only care about SentryHttpClient
. Being able to use SentryHttpClient in our App Clip without eating all 3 MB would be amazing
@sumanthratna hey thanks for raising this issue.
theoretically you could do Sentry.init
instead of SentryFlutter.init
but you would probably miss a lot of device context, stacktrace symbolication etc...
do you know if there are any signifcant changes in earlier versions?
-rwxr-xr-x 2.1 unx 2817968 bX 72% defN 24-Jul-19 16:19 Payload/RunnerAppClip.app/Frameworks/Sentry.framework/Sentry
this is the sentry-cocoa sdk taking up space, so I'm not sure if there is much we can do from the flutter side to optimize this.
this might be an issue that could be brought up in the sentry-cocoa repo
@buenaflor Thanks so much for your replies. I tried using Sentry.init
instead of SentryFlutter.init
and that removed the sentry-cocoa SDK from the build, which has helped us significantly -- Sentry Dart SDK is only ~0.3 MB.
Obviously, this solution is not ideal since now we don't get the features from sentry_flutter, but it's good enough for our App Clip needs. I think the ideal solution would be for Dart+Flutter to support tree-shaking native libraries, so then the Cocoa SDK could be stripped down to what we need but that's probably out of scope for you all. As a workaround, maybe splitting the Cocoa SDK into smaller SDKs with specific functionalities might allow Dart tree shaking to strip un-needed native code from the build.
Feel free to close since I don't think there are any easy solutions for this on your end.
Thanks for the help!
@sumanthratna modularizing the sentry-cocoa SDK is a long-term goal we have, but as you point out, not in the immediate scope for us. We definitely appreciate your input in any case. I'll close this issue for now, please leave a comment if there's a reason to reopen.
Platform
Flutter Mobile
Obfuscation
Enabled
Debug Info
Enabled
Doctor
Hi all,
We're big fans of Sentry but are unfortunately might need to move away from it: we're building an iOS App Clip (which constrains us to a ~15 MB uncompressed+thinned .ipa file). Flutter is ~10 MB and Sentry is ~3 MB (which is much larger than we thought it would be), leaving us with very little room to implement actual App Clip functionality, leveraging Flutter plugins, etc.
Here's a section of the output of
zipinfo -m RunnerAppClip.ipa
:(the fourth column is number of bytes)
As you can see, Sentry is ~3 MB. Are there optimizations that can be made?
Version
8.4.0
Steps to Reproduce
flutter create my_app
flutter pub add sentry_flutter
and callSentryFlutter.init
inmain
flutter build ipa --release --export-method development --analyze-size
open build/ios/archive/*.xcarchive
open the resulting directory and open
App Thinning Size Report.txt
and see the uncompressed sizeWe're happy to help on reducing the SDK size, but may need some guidance on how to approach this.
Expected Result
N/A
Actual Result
N/A
Are you willing to submit a PR?
Yes