powered by Jive Software

(a)smack 4RC, android proguard config for message events

Hi to all

(A)smack 4 RC2 latest, message event notifications work perfectly.

The problem is that I have hard times to make message event notifications to work after proguard obfuscation.

I use the proguard configuration provided in README of 4.0.0-rc snapshots (plus more stuff for other libs).

I need some help with added proguard config for message event notifications to work…

Thanks in advance

I added these lines in proguard config:

-keep class * implements org.jivesoftware.smackx.xevent.MessageEventNotificationListener

-keep class * extends org.jivesoftware.smackx.DefaultMessageEventRequestListener

-keep class org.jivesoftware.smackx.xevent.MessageEventManager

-keep class org.jivesoftware.smackx.xevent.MessageEventNotificationListener

-keep class org.jivesoftware.smackx.xevent.DefaultMessageEventRequestListener

but still nothing works regarding Message Events in Smack Extensions Documentation

When a client is obfuscated, it is not requesting or reply to message events notifications…

Error Log when sending message from the obfuscated client:

E/MessageEventManager(30371):

Error while invoking MessageEventNotificationListener

java.lang.NoSuchMethodException: deliveredNotification [class java.lang.String, class java.lang.String]

at java.lang.Class.getConstructorOrMethod(Class.java:472)

at java.lang.Class.getDeclaredMethod(Class.java:640)

at org.jivesoftware.smackx.xevent.MessageEventManager.b(ProGuard:42)

at org.jivesoftware.smackx.xevent.a.a(ProGuard:208)

at org.jivesoftware.smack.ay.a(ProGuard:1228)

at org.jivesoftware.smack.ax.run(ProGuard:1138)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)

at java.util.concurrent.FutureTask.run(FutureTask.java:237)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201 (ScheduledThreadPoolExecutor.java:152)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedu ledThreadPoolExecutor.java:265)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)

at java.lang.Thread.run(Thread.java:841)

Error Log when receiving message at the obfuscated client:

E/MessageEventManager(2438): Error while invoking MessageEventRequestListener

java.lang.NoSuchMethodException: deliveredNotificationRequested [class java.lang.String, class java.lang.String, class org.jivesoftware.smackx.xevent.MessageEventManager]

at java.lang.Class.getConstructorOrMethod(Class.java:472)

at java.lang.Class.getDeclaredMethod(Class.java:640)

at org.jivesoftware.smackx.xevent.MessageEventManager.a(ProGuard:42)

at org.jivesoftware.smackx.xevent.a.a(ProGuard:201)

at org.jivesoftware.smack.ay.a(ProGuard:1228)

at org.jivesoftware.smack.ax.run(ProGuard:1138)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)

at java.util.concurrent.FutureTask.run(FutureTask.java:237)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201 (ScheduledThreadPoolExecutor.java:152)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedu ledThreadPoolExecutor.java:265)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)

I assume this is because MessageEventManager uses reflection on MessageEvent(Notification|Request)Listener. Please note that XEP-22 Message Events is obsolete and will be moved to smack-legacy in a future release. I suggest you start using the provided up-to-date alternatives.

-keep class * implements org.jivesoftware.smackx.xevent.MessageEventNotificationListener

-keep class * extends org.jivesoftware.smackx.DefaultMessageEventRequestListener

-keep class org.jivesoftware.smackx.xevent.MessageEventManager { *; }

-keep class org.jivesoftware.smackx.xevent.MessageEventNotificationListener { *; }

-keep class org.jivesoftware.smackx.xevent.DefaultMessageEventRequestListener { *; }

Now the obfuscated client can send a message & request/receive successfully msg delivery notification

Still looking for how to reply to message delivery request when receiving a message…

Error Log when receiving message at the obfuscated client:

E/MessageEventManager(2438): Error while invoking MessageEventRequestListener

java.lang.NoSuchMethodException: deliveredNotificationRequested [class java.lang.String, class java.lang.String, class org.jivesoftware.smackx.xevent.MessageEventManager]

at java.lang.Class.getConstructorOrMethod(Class.java:472)

at java.lang.Class.getDeclaredMethod(Class.java:640)

at org.jivesoftware.smackx.xevent.MessageEventManager.a(ProGuard:42)

at org.jivesoftware.smackx.xevent.a.a(ProGuard:201)

at org.jivesoftware.smack.ay.a(ProGuard:1228)

at org.jivesoftware.smack.ax.run(ProGuard:1138)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)

at java.util.concurrent.FutureTask.run(FutureTask.java:237)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201 (ScheduledThreadPoolExecutor.java:152)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedu ledThreadPoolExecutor.java:265)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)

Thanks Flow for reply…

I managed to get working the obfuscated client when sending a message/receive msg delivery notification.

Need some help for the opposite case (how to reply to message delivery request when receiving a message).

Can you give me some info for the provided up-to-date alternatives?

-keep class * implements org.jivesoftware.smackx.xevent.MessageEventNotificationListener

-keep class * extends org.jivesoftware.smackx.DefaultMessageEventRequestListener

-keep class org.jivesoftware.smackx.xevent.** { *; }

-keep interface org.jivesoftware.smackx.xevent.** { *; }

Now working both ways… I guess I’m too old for this stuff

I’d love to have some info about the up-to-date alternatives as XEP-22 is obsolete

Successors are mentioned in XEP-22

I mean in (a)smack way, guess that using classes DeliveryReceipt*** is the way to go for message delivery receipts.

I hope that XEP-22 smack will not be moved to smack-legacy before the Documentation in smack extensions be updated