14

I've recreated a simple app that was originally made in React Native with 5MB file size on the app store. The app has no images or anything of any particular size, but it does use Admob ads.

After uploading it to the app store the build is showing as 35MB...not sure what the reason is but it when opening the package contents of the build archive it seems that a bunch of dylib files in SwiftSupport/iphoneos are created that are very large. that's the biggest folder in the archive anyway. I think it has to do with the Pods folder created in order to use Admob.

I'm guessing it can never be as small as the React Native original app but surely it should not be seven times the size...is there some way to remove the SwiftSupport files or another way to shrink it?

EDIT: Also in the Runner project folder in the build archive in Frameworks there are loads of Swift dylib files in there too that are large. Really all the space is being taken up by these Swift support dylib files...

Just built the app for Android and it's 8.33MB so quite a difference there, even though both versions of course use Admob.

7
  • you should check this issues for originally flutter GitHub github.com/flutter/flutter/issues/16833 Commented Jul 15, 2019 at 3:47
  • @Glamvian I don't think that issue is related. The minimum app size is "iPhone X remains at 10.8 MB." so that doesn't explain why my app is 35MB. They also don't mention the SwiftSupport issue which I think is a problem related to Admob. Commented Jul 15, 2019 at 4:15
  • Did you build the app with the release flag ? Commented Jul 15, 2019 at 7:58
  • @Muldec Yes of course, and it's already in the app store as a build. Commented Jul 15, 2019 at 8:44
  • Has anyone managed to create a Flutter app with Admob that does not have all these huge swift dylib files? If so I'd like to know how it was done. Commented Jul 15, 2019 at 8:53

2 Answers 2

2

This isn't really related to Flutter. Every iOS app containing code that wants to support iOS 11 and lower, needs to contain additional flutter libraries.

You can disable this in Xcode by setting "Always Embed Swift Standard Libraries" to false, and raising the deployment target to iOS 12.

Example of my flutter app with respect to different deployment targets. There is no change in build setting but deployment target only. iOS 13 does not include swift libraries with the build.

iOS version -> App build size 
10 -> 127.8 MB
11 -> 127.8 MB
12 -> 90.9 MB 
13 -> 49.6 MB
Sign up to request clarification or add additional context in comments.

2 Comments

This is actually not correct, my Apps are all encoded with Objective C only but are still WAY bigger than Android, it's nothing to do with Swift. This has actually already been acknowledged as a bug by the Flutter developers and they're looking into it. There have even been cases as extreme as 7.9MB for the Android version and 62.3MB for iOS for the exact same app exported from Flutter on the App stores. No ads used either...
If your app contains SwiftSupport directory then the flag I mentioned must have been enabled. There is no point in adding swift standard libraries if you don't have any Swift code. Check your plugins.
1

I have two sources: first [1] is titled 'Flutter vs Swift' and second [2] 'How to enable swift support for existing project in flutter'. Reading the both we observe flutter and swift do not have to co-exist and observing the latter we can see how it is enabled with a flag when creating the IOS package. I would first check that IOS folder is created without swift reference.

Third link [3] shows that Admob usage can be done in dart only.

About size, I am not sure though if using dart and disabling Swift would 100% make the trick. Flutter vs Swift link [1] has a native Swift app and 'comparison' equal Flutter app and conclusion was the size of flutter app was doubled about that of Swift app. And sizes where around 20 and 50 MB respectively, Flutter being the biggest.

Edit

It shows up the Swift is part of the plugin / module you use and thus cannot be easily just removed. About the size, Flutter app is normally already bigger than app with Swift and now the solution combines the both. Rise in size is as espected.

[1] https://blog.codemagic.io/flutter-vs-swift/

[2] How to enable Swift support for existing project in flutter

[3] https://flutterawesome.com/easily-implement-ads-into-a-flutter-app/

7 Comments

I followed this stackoverflow.com/questions/56987132/… to install my Admob. Do you think any of the steps in that answer lead to Swift support being unnecessarily added?
You had to add some Swift code in there. So most probably, the admob plugin depends on Swift. I found github.com/flutter/plugins/tree/master/packages/firebase_admob about fire base admob version, but it needs Firebase and may take some overhead, too.
I added some swift code? I just altered the Pod file is all...why would that add all those swift support files?
Well, you only added Swift version, anyways that implies the project has Swift involved. Otherwise such setting is pointless. It is part of the plugin you use, so props are you cannot just take it away in any way.
Isn't the Swift version always set in XCode? It has to be set to something..? I just checked a newly made basic fluttter app and it's set to Swift 4 in the xcode project. When I set up Admob for my other app all I did was change it to Swift 4.1.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.