Skip to content

Broad R8 keep rule for io.intercom.android significantly impacts app optimization #648

Description

@Sergey04IO

Hi,

We are using intercom_flutter in a Flutter application and noticed that the Intercom Android SDK includes a broad R8/ProGuard keep rule that has a significant impact on R8 optimization.

Environment

  • Flutter: 3.44.8
  • Dart: 3.12.2
  • intercom_flutter: 9.6.18
  • Android Gradle Plugin: 9.3.1
  • Gradle: 9.5.0
  • minSdk: 25

R8 shrinking, optimization, and obfuscation are enabled for the release build.

Issue

Using the R8 Configuration Analyzer available in AGP 9.3, one of the largest keep rules in our application is:

-keep class io.intercom.android.** { *; }

The rule comes from the consumer ProGuard configuration of the Intercom Android SDK.

In our application, this single rule keeps approximately:

  • 3,360 classes (6.0%)
  • 10,434 fields (7.1%)
  • 20,655 methods (6.9%)
  • 6.8% total impact

The rule prevents R8 from shrinking, optimizing, and obfuscating the affected Intercom code.

According to the R8 Configuration Analyzer, this is currently one of the keep rules with the largest impact in our application.

Question

Is it necessary for the Intercom Android SDK to keep all classes and members under io.intercom.android.**?

Would it be possible to narrow this consumer keep rule to only the classes or members that actually need to be preserved, so that R8 can shrink, optimize, and obfuscate the rest of the Intercom code where safe?

I have attached screenshots from the R8 Configuration Analyzer showing the impact and source/details of the rule.

Thank you.

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions