Open SzotsLevente opened 4 months ago
@SzotsLevente Seems like firebase dependency is not available at runtime. Can you share dependencies declared in gradle?
@piyush-kukadiya as you can see in the bottom of my post i've added all the dependancies that i've used in gradle, not sure if i've missed any, is there any mistake in my code? i've sent test notification for both type of devices from clevertap and received them, but this error is still happening on so many devices as crashlytics shows
gmsImplementation 'com.clevertap.android:clevertap-android-sdk:6.2.1' hmsImplementation 'com.clevertap.android:clevertap-hms-sdk:1.3.3'
hmsImplementation "com.huawei.hms:location:$huaweiLocationVersion" hmsImplementation "com.huawei.hms:push:$huaweiPushVersion"
implementation platform("com.google.firebase:firebase-bom:$firebaseBom") implementation 'com.google.firebase:firebase-analytics' implementation 'com.google.firebase:firebase-config' implementation 'com.google.firebase:firebase-crashlytics' gmsImplementation 'com.google.firebase:firebase-messaging' implementation 'com.google.firebase:firebase-perf' implementation 'com.google.firebase:firebase-storage'
@SzotsLevente Can you share small sample app reproducing this issue. It's mostly configuration issue because com/google/firebase/messaging/RemoteMessage is not available at run time. You an also try to validate this error by checking if com/google/firebase/messaging/RemoteMessage
exists in your decompiled apk. One more case you need to check is Proguard. Proguard can rename class names in final release build.
@piyush-kukadiya the above mentioned code is simply put in a service that extends HmsMessageService and for gms FirebaseMessagingService, in both i check as it shows above that if it's from clevertap i use CleverTapAPI.createNotification(applicationContext, extras) if not i'm handling it as i should, the error occures mostly on huawei devices(with google services) i've checked proguard all firebase and hms related things are there with --keep, do you have a sample app where all should work so i can compare with it? fcm + hms + clevertap
i've the import for that for sure other way it would crash my other implementation that is not related with clevertap,
gmsImplementation 'com.google.firebase:firebase-messaging'
My class that extends FirebaseMessagingService has the import -> import com.google.firebase.messaging.RemoteMessage and it works just fine
HmsMessageService has the following import -> import com.huawei.hms.push.RemoteMessage
@SzotsLevente I am testing out, will get back here with findings.
@SzotsLevente we have tested this on Huawei P30. It's working fine from our end. Please raise internal support ticket with our support team via the Help Center.
@piyush-kukadiya already done that, have you tested out my code? can you link your sample project, would like to take look at it and compare, there must be some difference if it's working for you.
@SzotsLevente I tested this in our internal app, but I am still sharing the new sample app here: https://github.com/pulsee/CleverTapHuawei
@SzotsLevente Also, please note that CTFirebaseMessagingReceiver
will only be invoked when the push notification is from Firebase. If the push notification is from HMS, CTFirebaseMessagingReceiver
will not be triggered at all.
@piyush-kukadiya yeah i know that only phones that reacive from firebase will trigger that, that's why it's fishy, because my firebase implementation works properly, the only new thing that i've added was clevertap and those devices that i've mentioned use google play services so they receive notifications from firebase/CTFirebaseMessagingReceiver, that's why i don't understand why that error occurs.
the only thing is different now is that i've this verification added where i check if it's coming from clevertap or not remoteMessage.data.apply(on hms -> remoteMessage.dataOfMap.apply) { try { if (isNotEmpty()) { val extras = Bundle() for ((key, value) in this) { extras.putString(key, value) } val info = CleverTapAPI.getNotificationInfo(extras) Log.d( TAG, "onMessageReceived: {info.fromCleverTap}" ) if (info.fromCleverTap) { CleverTapAPI.createNotification(applicationContext, extras) }else{ //same old firebase stuff goes here/or hms stuff } } } catch (e: Exception) { Log.e(TAG, "onMessageReceived: ${e.message}") } }
Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/messaging/RemoteMessage; at com.clevertap.android.sdk.pushnotification.fcm.CTFirebaseMessagingReceiver.onReceive(CTFirebaseMessagingReceiver.java:110) at android.app.ActivityThread.handleReceiver(ActivityThread.java:4637) at android.app.ActivityThread.access$2900(ActivityThread.java:260) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2465) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:219) at android.app.ActivityThread.main(ActivityThread.java:8668) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
Recently implemented push notification for fcm and huawei as well getting the following error on some samsung s23, note 20 ultra 5g, motorola edge 30, oppo A79 5g and mostly on huawei phones like p30 pro, p30 lite, nova 5T, p20 pro, p20 lite, mate 20 pro, mate 10 pro.. list goes on
To Reproduce what i've done is the following in the HmsMessagingService and in the FirebaseMessagingService as well:
CleverTapAPI.createNotificationChannel(applicationContext, channelId, getString(R.string.app_name), getString(R.string.app_name), NotificationManager.IMPORTANCE_HIGH, true)
remoteMessage.data.apply(on hms -> remoteMessage.dataOfMap.apply) { try { if (isNotEmpty()) { val extras = Bundle() for ((key, value) in this) { extras.putString(key, value) } val info = CleverTapAPI.getNotificationInfo(extras) Log.d( TAG, "onMessageReceived: $info ---- ${info.fromCleverTap}" ) if (info.fromCleverTap) { CleverTapAPI.createNotification(applicationContext, extras) } } } catch (e: Exception) { Log.e(TAG, "onMessageReceived: ${e.message}") } }
Crashlytics show that this issue happens mostly on android 10(like 90% of the cases)
ps i'm using these: gmsImplementation 'com.clevertap.android:clevertap-android-sdk:6.2.1' hmsImplementation 'com.clevertap.android:clevertap-hms-sdk:1.3.3'