2

I installed the SDKs for both Android and iOS to use the Live Agent for my company.

Although the built app size on Android/iOS grew by at least 25MB!

Is there any reason why it's so huge? I can't figure out a way to reduce the size of the final app.

Edit:

I was able to get the Android down to about 2MB.

Although for iOS I keep fighting with it. For some reason the ServiceChat is dependent of the SalesforceAnalytics.framework and SalesforceAnalytics is dependent of others... which basically forces me to import lots of frameworks.

enter image description here

This is the entire list of frameworks I need to import in order to get the live chat working:

enter image description here

1
  • I've reached out to the team responsible for the Snap Ins SDK for comment.
    – Bill Mote
    Oct 20, 2017 at 19:50

2 Answers 2

2

For the Android app it sounds to me like you are including all of the Sdks when you only want to use chat. If so the below tips may help. I see sizes increases of <2MB when I compile just the chat sdk however your milage may vary.

Consider depending on just the chat-ui(or chat-core) artifact instead of the servicesdk artifact. Take a look at the developer docs here to see how you can do that. https://developer.salesforce.com/docs/atlas.en-us.noversion.service_sdk_android.meta/service_sdk_android/android_install_sdk.htm

An alternate option would be to include servicesdk and exclude the things you don't want. compile("com.salesforce.service:servicesdk:${rootProject.ext.serviceSdkVersion}") { exclude group: 'com.salesforce.service', module: 'sos' exclude group: 'com.salesforce.service', module: 'knowledge-ui' exclude group: 'com.salesforce.service', module: 'case-ui' }

Also be sure to enable minification in Proguard to further decrease the size of your app. https://developer.salesforce.com/docs/atlas.en-us.noversion.service_sdk_android.meta/service_sdk_android/android_apk.htm

2
  • I'll give this a try for Android, thanks. Any idea about iOS?
    – alexmngn
    Oct 22, 2017 at 14:51
  • Hi @alexmngn I just wanted to let you know snap-ins just released it's 212 which reduced the number of dependencies (removed SalesforceAnalytics). Upgrading to this version should reduce your app footprint on ios and android.
    – Steve T
    Mar 6, 2018 at 17:10
1

Calculating the size of a framework on iOS isn’t straightforward, and the size of the binaries on disk do not reflect the end result that will impact your application.

  1. These frameworks are “Universal” binaries, which include the compiled products for each unique architecture (i386 and x86_64 for the simulator, and armv7 and arm64 for devices). When these binaries are embedded in your application, and uploaded to iTunesConnect, Apple’s “App Slicing” feature will separate out each architecture, only delivering the appropriate one to your customer’s device. The same thing goes for any image resources that may be specific to an individual device (e.g. iPad vs iPhone, 2x vs 3x).
  2. These frameworks also include Bitcode information, which is essentially the intermediate compiler objects produced as a part of the build process. This information can be quite large, and like architecture slices, is stripped from the finished product before it is shipped to a device. In fact, bitcode is never sent to a customer device as this information is used by Apple to on-demand optimize the compiled code as-needed.
  3. The applications, when downloaded from the App Store, are delivered compressed to user’s devices. This means that the OTA (over-the-air) install limit is based on the compressed size, not the uncompressed size of your application. Additionally, Apple ensures that incremental upgrades are provided so if a set of files within a new version of your application have not changed, those files are not downloaded. As a result, if a user upgrades your app and the Snap-ins SDK’s files haven’t changed (or if only a subset of them have changed), only the deltas are sent OTA to the device.
  4. The Snap-ins SDK is built on top of the Salesforce Mobile SDK, but not all features of it are used. As a result, if your application doesn’t directly use the Mobile SDK, only certain frameworks need to be included; the other frameworks are only included for completeness. For more information on these frameworks, see our developer guide documentation here: https://developer.salesforce.com/docs/atlas.en-us.noversion.service_sdk_ios.meta/service_sdk_ios/ios_install_sdk_manually.htm#ios_sdk_install_ios_manually
  5. The Snap-ins SDK is designed in such a way that each individual component is separated into its own framework, with the ServiceCore framework included as a common foundation for our SDK features (Knowledge, Case Management, Live Agent Chat, and SOS). As a result, if your product only needs to use one or two of the Snap-ins features, you only need to include a subset of the frameworks within your application. In this way you can mix-and-match the set of components to meet your application’s needs.

We don’t have current numbers published for the per-architecture/device sizing for our SDK components, but a recent validation process we went through showed that the compressed ServiceCore/MobileSDK contributed less than 2MB to an app size, while Chat and Cases used less than 400kb each on top of that.

For more information on Apple’s App Thinning, Slicing, and Bitcode features, you can check out their App Thinning guide. (https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/AppThinning/AppThinning.html)

1
  • Hello Michael, thanks for your answer. Some frameworks have dependencies on other frameworks like your documentation says - as you can see on the screenshot in the post, ServiceChat requires SalesforceAnalytics - this makes the app grow and that's my main concern. I've tried to generate the final app build for an iPhone 8 Plus and the size added was +29MB just to use the live chat feature.
    – alexmngn
    Oct 25, 2017 at 13:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .