Twitter reduces app size by a third with app bundles

Learn how Android App Bundles helped Twitter simplify and reduce their app size.

Background

Keeping the app lightweight and easy to install is very important to the team at Twitter especially for users in emerging markets where spotty data connections make large apps a problem. “We want to make it possible for anyone, anywhere to use Twitter, particularly in emerging markets, and found that APK size is a hurdle for adoption for many people,” said César Puerta, Senior Staff Software Engineer at Twitter. “App Bundles gave us a straightforward solution to significantly reducing distribution size without any hassle on our side.”

What they did

Before adopting the app bundle, Twitter was manually splitting their app into four ABIs, which helped them reduce the size by a fair amount. But the app bundle presented a much simpler and even more effective approach, so they were eager to make the switch.

Twitter spent time reviewing Play App Signing, a requirement of the app bundle, to ensure it met Twitter's security standards before deciding to proceed. “We had the foresight to carry it out plenty of time in advance,” César said. But “once the final version of app bundles was available, adoption was fairly straightforward, and we didn’t see any regressions in behavior.”

During the development process, they used bundletool to extract APKs that they distributed to their QA team. They also tested their app bundles extensively with a large pool of users before rolling out to production. The process worked so well that they later switched their internal “dogfood” app to the Play Store for better coverage and faster issue spotting.

Results

When the conversion was complete, the team rolled out the new modularized version of the app to their 13.6 million users without a hitch. Because Twitter’s releases were already automated, the new release process was very similar to what they’d done before. But there was an unexpected upside: “Handling a single version ID per release instead of four (for ABI splits) did help us consolidate our metrics,” César said.

More importantly, they reported app size savings of 30-40% across the board — in addition to the savings they’d already achieved by using the ABI split. One of the ways they were able to do that was by using a feature module to distribute a large native library — 3MBs per ABI — that was only needed in a small number of devices.

Next up for Twitter are plans to migrate Periscope , Twitter’s live video-sharing app, to the app bundle, as well. His team is also working on modularizing the whole Twitter app. And “once we switch to entirely isolated feature modules, we’re likely to consider dynamic distribution for a number of features,” César said, noting that it was probably still 6-12 months down the line. He’s also hoping that modularization would allow their developers to reuse modules for both Twitter and Periscope, saving them a lot of time and unnecessary duplication.

Get started

All app and game developers can use Android App Bundles. Get started today!

Go to Play Console