Google Urges Library Providers: Overly Broad Keep Rules Hinder R8 Optimisation and the Google Play DEX Threshold
The Android Developers' Blog (17 November 2026) reminds library providers to ship narrow consumer keep rules so that R8 optimisation in apps is not hindered.
This article was prepared with AI assistance from the official sources listed below, and checked automatically before publication.
On 17 November 2026, the Android Developers' Blog published guidance for library and SDK providers on how to write narrower consumer keep rules. The aim is for app-level R8 optimisation to meet the DEX code optimisation threshold recently announced by Google Play. The article, written by Developer Relations Engineer Breana Tate, stresses that overly broad rules from libraries now directly affect the metrics app developers see in Play Console.
What Google said
According to the Android Developers' Blog, Google Play recently announced a DEX code optimisation threshold for apps and games. The threshold is intended to help improve startup time and reduce memory footprint.
Key points from the guidance:
- R8 can only optimise an app according to the parameters it is given, including the keep rules carried by the libraries the app uses.
- Keep rules that apply to an entire package or are otherwise too broad are not recommended as a long-term solution for preventing crashes, because they limit R8's whole-program optimisation.
- Broad rules prevent R8 from removing unused code.
- DEX code optimisation insights are now added to Play Console. The metrics app developers see combine the impact of rules from the app itself and from integrated libraries.
Why this matters
Until now, keep rules from libraries have often gone unnoticed because they are carried along automatically when a dependency is added. With the insight now in Play Console, the consequences become visible: a single SDK that ships overly wide rules can reduce the optimisation results of the whole app, even though the app's own code is already clean.
Google also provides the R8 Configuration Analyzer. This tool shows inefficient keep rules, whether they come from the app or from consumer keep rules bundled in libraries.
Implications for app teams in Indonesia
Many apps in Indonesia depend on a variety of third-party SDKs for payments, maps, analytics and e-KYC. SDKs like these may carry keep rules that are too broad. Possible effects include a poorer DEX optimisation score in Play Console, slower startup and higher memory usage. This is felt especially on the mid-range and entry-level devices widely used in Indonesia.
For organisations that develop public-service or financial apps, this is also a consideration when selecting and evaluating SDK vendors, because the quality of a library's configuration now affects an app's release metrics.
Practical steps
For app development teams:
- Run the R8 Configuration Analyzer and review inefficient rules.
- Identify which libraries carry broad keep rules.
- Monitor DEX code optimisation insights in Play Console.
- Ask SDK vendors to provide narrower rules.
For library providers:
- Avoid package-level keep rules or other broad rules as a way to prevent crashes permanently.
- Write consumer keep rules that cover only the classes and members that genuinely need to be retained, so that R8 can still remove unused code.
This change shifts responsibility for optimisation to the entire dependency chain. Teams that check their configuration early will be better prepared for the Google Play threshold.
Sources & references
This article is a summary and interpretation by the Oemah Solution team of the sources below. Refer to the original sources for full details and context.
