How we reduced the Life360 Android App Size

Pablo Baxter
Life360 Engineering
5 min readFeb 24, 2021

Like any good tech article let’s start with a small story… For the last few years, we have put in a lot of work into the Life360 app, with the release of a new UI back in 2019, continuous work with our collision detection, and new safety features. Even with the pandemic, it’s been a whirlwind of work improving and maintaining the app. However, as with any software that has new features added to it, our Android app size started growing.

So how were we doing with the app download size?

You could say we let the app go a bit…

As you can see, we did quite a bit of cleanup of old code and assets towards the start of the year. This was a followup to our revamp of the UI from 2019. At the time, we actually had a less than 30MB app download for quite a few months, so we were quite satisfied until we saw the minor spike in July. It wasn’t great, but it wasn’t all bad until August… where the download size grew by about 19.6% to 35.4MB!

What about install size?

Maybe a lot.

Similar to the download size chart, everything was fine (for the most part) until that August release. That’s where we saw a large jump in our install size. And then another smaller one… then another. Clearly, we were trending towards having larger download and install sizes.

So what did you do to reduce the app size?

Trimming our libraries

One of the first things we did was look at our library usage, and we noticed that we still kept many of the libraries that were used with the old UI, but no longer needed for the new UI. So we channeled Marie Kondo and found everything that did not spark joy and threw it away. We also found that some libraries included a lot of code we did not use anywhere. We went through all these “heavy” libraries, and looked for those that brought in only the code that we needed (ex. play-services-ads-identifier vs play-services-ads). After this cleanup, we had dropped the APK size by 1.6MB, with practically no code changes. Wonderful!

Using Android App Bundle

However, that wasn’t enough… So we took another look at what else we could do… A bit of history: a few Android teams had been looking at migrating our build process from building APKs to Android App Bundles, but it kept being pushed back due to other work. Given the app size spike, we finally brought it to the forefront, and began work on it immediately. To build an Android App Bundle (AAB) was simple: we just had to change assemble to bundle in the command line (seriously, no other code change was needed). The reason we kept pushing this task back was due to the work required with our CI tool, ensuring that our release process ran as smoothly as before, and that all teams that depended on certain artifacts still had access to them. After all was done, we had dropped an incredible 13.5MB to the app download size!

On top of that, we got the added bonus of not having to worry about the impending requirement from Google in the second half of 2021…

Switching from ProGuard to R8

We weren’t done though. There was one final thing we could use to drop just a few more bytes: using R8. We still had been using ProGuard at this point, and had been looking to switching to R8, but again, that was pushed back… until now. Going through our current ProGuard rules, and working closely with our amazing Test team, we switched to using R8, ensured there was no impact with the Android app, and got our last bit of savings: another 1.6MB drop!

So how were we doing with the app download size now?

Yes, that line is under the 18MB threshold! ^^

To describe the image above, the first drop you see is when we migrated to using AAB and did the library trim. The second drop was from R8. Overall, This is an almost 50% decrease in size for the app download! And that wasn’t even the best part…

Red highlight for emphasis!

New users installing the Life360 app would download a 17.8MB APK…

Updates would be 9.14MB! That is a 26.3MB savings on just an update.

Yes, this was our collective faces when we saw it

Did the install size change as well?

Install size reduced by almost 33%!

We knew there would be a reduction in the install size (thanks to how Android App Bundle works), and this chart just proves we were on the right path. We had peaked at about 160MB for the install size before settling at about 100MB after our changes.

Getting a good look at our journey

Given these incredible reductions in size, we went back in time and compared our download size to the earliest data we could get from Google Play Console and found this…

This is the smallest we’ve ever had the app download size in the last 4 years!

This is the smallest we have had the Life360 app since early 2017, and this was done without losing any features we have added to the app since.

Not as impressive, but still a feat!

Unfortunately, our install size didn’t follow suit with the app download size, but this is definitely the right track towards reducing our app size.

So what’s next?

This is just the start of the story. The entire Android team is still hard at work making improvements to the Life360 app, migrating away from bloated libraries for smaller, more performant ones. Even with how small our app is now, there is still more work left to make it even smaller!

Come join us

Life360 is creating the largest membership service for families by developing technology that helps managing family life easier and safer. There is so much more to do as we get there and we’re looking for talented people to join the team: check out our jobs page.

--

--