Overview
When you add the Persona SDK to your mobile app, the size of your app increases. How much the size increases depends on the code in your app. In this article, you’ll learn:
- Why it's important to know the size of your app.
- How to measure the exact size the SDK adds to your app.
- How to estimate the maximum size the SDK may add to any app.
- Why adding the SDK can cause a different size increase in different apps.
App size affects customer downloads
The total size of your app can affect whether customers download your app, and whether your app is allowed in an app store. As one data point, an experiment run by Segment showed that a larger app size leads to lower install rates [0]. Mobile platforms also shield their users from large apps: the Apple App Store warns users if an app is larger than 200 MB, and the Google Play Store does not allow apps larger than 150 MB [1].
Measure the exact size the SDK adds to your app
To measure the exact size the Persona SDK adds to your app, calculate the difference in your app’s size before and after you add the SDK. Here’s how:
- Remove the Persona SDK from your app, if you have already integrated it.
- Run a clean build of your app. Then note the size of your app—let’s call this Size A.
- Add the Persona SDK to your app.
- Run a second clean build of your app. Then note the size of your app—let’s call this Size B.
- Calculate the difference between Size B and Size A.
Estimate the maximum size the SDK may add to an app
If you don’t yet have an app, you can still estimate the maximum size the Persona SDK is likely to add to any app you build.
To get this estimate, follow the same steps in the Measure the exact size the SDK adds to your app section, with one difference. Instead of using your existing app, create a starter template app using the “New Project” wizard in your mobile platform. If the “New Project” wizard offers several options, choose the simplest app possible.
Why the size of the SDK depends on your app's code
When you add the Persona SDK to your app, the total code added is the SDK itself (about 70 KB), plus all the transitive dependencies of the SDK that aren't already used in your app. These transitive dependencies can add a few MB to your app.
More shared dependencies, smaller size increase
The code in the Persona SDK is about 70 KB. Our code depends on other libraries, many of which depend on other libraries, and so on. These other libraries are called transitive dependencies.
Some of these transitive dependencies are popular libraries that may already be included in your app.
The more overlap in dependencies your app has with the Persona SDK, the less your app's size will grow when you add the SDK. This is because modern build systems (such as Android’s Gradle) ensure each dependency is included at most once.
Starter template apps usually have no transitive dependencies, and that's why they can give you a good estimate of the maximum size the SDK will add to any app.
References
[0] An experiment run by Segment showed that a larger app size leads to lower install rates. (source)
[1] The Google Play Store does not allow apps larger than 150 MB. (source)