[9.4.3]Android crash :When app receives a notification. Unable to instantiate receiver io.maido.intercom.PushInterceptReceive
java.lang.RuntimeException: Unable to instantiate receiver io.maido.intercom.PushInterceptReceiver: java.lang.ClassNotFoundException: Didn't find class "io.maido.intercom.PushInterceptReceiver".. Caused by: java.lang.ClassNotFoundException: Didn't find class "io.maido.intercom.PushInterceptReceiver"
Flutter version 3.32.7 firebase_messaging: ^15.2.4
Our app has a lot of notifications for our own business, which originally had nothing to do with intercom. However, after I updated the intercom SDK, when I received the app's own notifications on the Android app (eg: someone follow me notification), the system crashed here.: @deepak786
java.lang.RuntimeException: Unable to instantiate receiver io.maido.intercom.PushInterceptReceiver: java.lang.ClassNotFoundException: Didn't find class "io.maido.intercom.PushInterceptReceiver".
How to fix this.
@fenngzui Not sure what is the issue. Could you please share your AndroidManifest file?
After upgrading the Intercom SDK, the same issue occurred, there is no declaration of PushInterceptReceiver in AndroidManifest. Could this be related to the obfuscation rules in proguard-rules.pro?
I believe it is because of the Obfuscation. See https://stackoverflow.com/q/50392706
Are you using any Proguard rules at the moment? Please share.
I tested with the following Progaurd rules and its working fine.
-keepattributes SourceFile,LineNumberTable # Keep file names and line numbers.
-renamesourcefileattribute SourceFile
-keep public class * extends java.lang.Exception # Optional: Keep custom exceptions.
The above rules are saved under file proguard-rules.pro.
And this is how they are applied in Gradle file
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
It's happening on development env where we have no obfuscation
@KestasVenslauskas Can you please share the MVP of the issue? So that I can check if something is wrong in Gradle configuration, etc.
Can anyone please tell me up to which intercom_flutter version this is working fine?
Note: in intercom_flutter: 9.3.2, firebase_messaging dependency version was updated from 23.3.1 to 24.1.1. See https://github.com/v3rm0n/intercom_flutter/pull/534
@deepak786 I reverted back to 9.3.1 where the last time it was working normally, but looks like right now it crashes the in the same way. Maybe the underlying SDK is broken?
Did you try the flutter clean?. Because maybe it is still using the updated version.
@deepak786 Flutter clean helped to make it work with 9.3.1 will try newer versions
@deepak786 Looks like intercom_flutter: 9.4.4 works after flutter clean
@deepak786 Looks like intercom_flutter: 9.4.4 works after flutter clean
Based on this, I suggest everyone to try the flutter clean.
@deepak786 will this resolve Android crash related to java.lang.IllegalStateException also?
intercom_flutter: 9.4.x all crashed when app received notification. Instabug Caught an Unhandled Exception: java.lang.RuntimeException E/IBG-Core(10297): java.lang.RuntimeException: Unable to instantiate receiver io.maido.intercom.PushInterceptReceiver: java.lang.ClassNotFoundException: Didn't find class "io.maido.intercom.PushInterceptReceiver" on path
E/IBG-Core(10297): at android.app.ActivityThread.handleReceiver(ActivityThread.java:4693) E/IBG-Core(10297): at android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0) E/IBG-Core(10297): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2399) E/IBG-Core(10297): at android.os.Handler.dispatchMessage(Handler.java:107) E/IBG-Core(10297): at android.os.Looper.loopOnce(Looper.java:232) E/IBG-Core(10297): at android.os.Looper.loop(Looper.java:317) E/IBG-Core(10297): at android.app.ActivityThread.main(ActivityThread.java:8592) E/IBG-Core(10297): at java.lang.reflect.Method.invoke(Native Method) E/IBG-Core(10297): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580) E/IBG-Core(10297): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878) E/IBG-Core(10297): Caused by: java.lang.ClassNotFoundException: Didn't find class "io.maido.intercom.PushInterceptReceiver" on path: DexPathList[[zip file "/data/app/~~G0yuzNVNUQZT4kynHUWZ5Q==/
E/IBG-Core(10297): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) E/IBG-Core(10297): at java.lang.ClassLoader.loadClass(ClassLoader.java:637) E/IBG-Core(10297): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) E/IBG-Core(10297): at android.app.AppComponentFactory.instantiateReceiver(AppComponentFactory.java:110) E/IBG-Core(10297): at androidx.core.app.CoreComponentFactory.instantiateReceiver(CoreComponentFactory.java:59) E/IBG-Core(10297): at android.app.ActivityThread.handleReceiver(ActivityThread.java:4686) @deepak786