The application is crashing with a ClassNotFoundException specifically for io.maido.intercom.PushInterceptReceiver | Community
Skip to main content

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 my proguard-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 for PushInterceptReceiver, which I believe is automatically merged by the intercom_flutter plugin. Since the crash only occurs in release builds, I suspect it's a ProGuard/R8 issue.

My Questions:

  1. Why would R8 remove the io.maido.intercom.PushInterceptReceiver class despite the existing keep rules for the Intercom SDK?

  2. Is the package name io.maido.intercom different from io.intercom.android? Should I add a specific keep rule for io.maido related classes?

  3. Are there any other common reasons for intercom_android's BroadcastReceiver to be missing in a release build?

  4. What is the best practice to fix this specific issue?

Hey ​@Cathy 👋 Jacques here from Intercom Support. I hope all is well today!

 

Why is the io.maido.intercom.PushInterceptReceiver class missing in release builds?

The crash is caused by a ClassNotFoundException for io.maido.intercom.PushInterceptReceiver in your release build. This typically happens because the class is being removed by R8/ProGuard during the minification and shrinking process. Your current ProGuard rules only keep classes in the io.intercom.android and com.intercom packages, but not those in the io.maido.intercom package.

 

Is io.maido.intercom different from io.intercom.android? Should I add a keep rule for io.maido?

Yes, io.maido.intercom is a different package from io.intercom.android. The io.maido.intercom.PushInterceptReceiver class is not covered by your current keep rules. You should add a specific keep rule for the io.maido.intercom package to prevent R8/ProGuard from removing it. For example:

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

This will ensure that all classes under io.maido.intercom are retained in your release build.

 

Are there other common reasons for Intercom's BroadcastReceiver to be missing in release builds?

The most common reason is R8/ProGuard stripping out classes that are only referenced in the manifest (and not directly in code), which is exactly the case for broadcast receivers like PushInterceptReceiver. If a receiver is only declared in the manifest and not referenced in your code, R8/ProGuard may consider it unused and remove it unless explicitly kept.

Other less common causes include: - Incorrect or missing manifest merging (but you already checked this). - Using an outdated or unofficial plugin that references a class not present in the current SDK. - MultiDex issues, but these usually result in different errors.

 

What is the best practice to fix this specific issue?

Add a keep rule for the io.maido.intercom package in your proguard-rules.pro file:

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

This, in addition to your existing rules, will prevent R8/ProGuard from removing the PushInterceptReceiver and any other necessary classes in that package.

 


 

In short:
R8/ProGuard is removing io.maido.intercom.PushInterceptReceiver because your keep rules do not cover the io.maido.intercom package. Add a keep rule for io.maido.intercom.** to resolve the issue. This is a common problem with manifest-only referenced classes in release builds, especially with unofficial or third-party plugins.