Microsoft Chao Zhang Mar 30, 2021

Reducing Android app size in practice at LinkedIn | by Chao Zhang | Microsoft Mobile Engineering | Medium

Article Summary

LinkedIn reduced their Android app size by 27.5MB through aggressive optimization. Here's how they did it without compromising features.

Chao Zhang from LinkedIn's mobile team shares battle-tested techniques for Android app size reduction. This goes beyond the standard documentation to cover advanced strategies that delivered measurable results at scale.

Key Takeaways

Critical Insight

LinkedIn achieved significant app size reduction through Play Feature Delivery, R8 optimization, and strategic resource management, backed by quantitative analysis proving correlation between app size and install rates.

The team discovered a critical issue with error grouping that affects 25% of crashes when enabling R8 optimization, plus a workaround that most teams don't know about.

About This Article

Problem

LinkedIn enabled R8 optimization with stack trace obfuscation, which broke error grouping in their crash reporting tool. About 25% of crashes with lambda groups showed different stack traces after the optimization turned on.

Solution

Chao Zhang's team fixed this by switching to the retrace tool that comes with the latest R8 version instead of using the standalone command-line tool. The bundled version updates more frequently and has the latest bug fixes.

Impact

When LinkedIn upgraded to Android Gradle Plugin 4.1, they saw an unexpected 6MB reduction in app size. This happened because the R class is no longer kept by default. It showed the value of testing preview versions of AGP.