My Flutter application has reported a crash in the Google Play Console. The crash is a java.lang.RuntimeException
with an underlying ClassNotFoundException
, specifically because the Android runtime is unable to find the io.maido.intercom.PushInterceptReceiver
class.
Crash Stack Trace (Core):
Fatal Exception: java.lang.RuntimeException:
Unable to instantiate receiver io.maido.intercom.PushInterceptReceiver: java.lang.ClassNotFoundException: Didn't find class "io.maido.intercom.PushInterceptReceiver" on path: DexPathList[...]
My Project Configuration:
-
Intercom Plugin Version:
intercom-android: 17.0.2
-
ProGuard/R8 Rules: I have already added a
keep
rule for the Intercom SDK in myproguard-rules.pro
file:-keep class io.intercom.android.** { *; }
-keep class com.intercom.** { *; } -
Troubleshooting Steps Taken: I've checked my
AndroidManifest.xml
and there is no manual declaration forPushInterceptReceiver
, which I believe is automatically merged by theintercom_flutter
plugin. Since the crash only occurs in release builds, I suspect it's a ProGuard/R8 issue.
My Questions:
-
Why would R8 remove the
io.maido.intercom.PushInterceptReceiver
class despite the existingkeep
rules for the Intercom SDK? -
Is the package name
io.maido.intercom
different fromio.intercom.android
? Should I add a specifickeep
rule forio.maido
related classes? -
Are there any other common reasons for
intercom_android
'sBroadcastReceiver
to be missing in a release build? -
What is the best practice to fix this specific issue?