Android: 9.6.21 crashes in release mode with R8/ProGuard enabled
Description
After upgrading intercom_flutter from 9.6.20 to 9.6.21, the Android app started crashing in release mode.
The issue does not happen in debug mode.
Versions 9.6.19 and 9.6.20 work correctly with the same project configuration.
Environment
- Flutter: 3.44.8
- Android Gradle Plugin (AGP): 9.3.1
- Gradle: 9.5.0
- intercom_flutter: 9.6.21
Crash log
Caused by java.lang.IllegalArgumentException: Required value was null.
Fatal Exception: java.lang.ExceptionInInitializerError
at io.intercom.android.sdk.m5.data.IntercomDataLayer.activityReadyForViewAttachment(IntercomDataLayer.java:281)
at io.intercom.android.sdk.ActivityLifecycleHandler.handleMessage(ActivityLifecycleHandler.java:46)
at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7870)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1009)
What I tested
intercom_flutter 9.6.19 — works
intercom_flutter 9.6.20 — works
intercom_flutter 9.6.21 in debug mode — works
intercom_flutter 9.6.21 in release mode — crashes
Workaround
Adding these rules to the ProGuard/R8 configuration fixes the crash:
-keep class io.intercom.android.** { *; }
-dontwarn io.intercom.android.**
After adding these rules, 9.6.21 works correctly in release mode.
It looks like this may be related to the R8/ProGuard consumer rules in the Android Intercom SDK used by intercom_flutter 9.6.21.
Could you please check if some required ProGuard/R8 rules are missing in 9.6.21?
Ideally, it should not be necessary to keep the entire io.intercom.android package manually.
Android: 9.6.21 crashes in release mode with R8/ProGuard enabled
Description
After upgrading
intercom_flutterfrom9.6.20to9.6.21, the Android app started crashing in release mode.The issue does not happen in debug mode.
Versions
9.6.19and9.6.20work correctly with the same project configuration.Environment
Crash log
What I tested
intercom_flutter 9.6.19— worksintercom_flutter 9.6.20— worksintercom_flutter 9.6.21in debug mode — worksintercom_flutter 9.6.21in release mode — crashesWorkaround
Adding these rules to the ProGuard/R8 configuration fixes the crash:
After adding these rules,
9.6.21works correctly in release mode.It looks like this may be related to the R8/ProGuard consumer rules in the Android Intercom SDK used by
intercom_flutter 9.6.21.Could you please check if some required ProGuard/R8 rules are missing in
9.6.21?Ideally, it should not be necessary to keep the entire
io.intercom.androidpackage manually.