Microsoft SwiftKey Jun 23, 2020

App Size Reduction at Microsoft SwiftKey

Article Summary

Microsoft SwiftKey slashed their Android app size by 50% and boosted install conversions. Here's the playbook they used to get there.

The SwiftKey team documented their year-long journey reducing app bloat across 72 languages and 650+ keyboard layouts. They tackled everything from ProGuard configs to native libraries, sharing wins and head-scratchers along the way.

Key Takeaways

Critical Insight

Small optimizations across ProGuard, native libraries, resources, and AABs compounded into massive size reductions that increased install conversions in key markets.

Their ProGuard configuration mistake is probably happening in your app right now, and the fix takes minutes.

About This Article

Problem

SwiftKey's ProGuard configuration had been tweaked many times over the years. The team realized they were turning off most optimizations by mistake. The -optimizations flag works as a filter where negated values actually enable everything except what you specify.

Solution

Microsoft looked into the ProGuard documentation and added flags that hadn't been used before: repackageclasses, renamesourcefileattribute, and allowaccessmodification. They also turned on arithmetic optimizations that are safe for Android 2.0 and later.

Impact

The ProGuard changes cut the DEX method count by 11% and DEX size by 9%. This helped reduce the overall install size by 2%, which came to about 1 MB smaller even with the triple-tax effect on compiled code.