I am using the smack library (4.1.2) in my Android app to connect to an XMPP server. It runs perfectly well when the code is NOT minified (ie with proguard). But in release mode, with proguard enabled, the app crashes as soon as it connects to the server.
I am trying to keep all relevant smack classes unminified as suggested here: What are the recommended ProGuard rules for Smack 4.1?
-keep class org.jivesoftware.smack.** { *; }
-keep class org.jivesoftware.smackx.** { *; }
But for me this doesn't work. Below is the crash stack trace.
java.lang.ExceptionInInitializerError
at org.jivesoftware.smackx.privacy.PrivacyListManager.<init>(PrivacyListManager.java:126)
at org.jivesoftware.smackx.privacy.PrivacyListManager.getInstanceFor(PrivacyListManager.java:210)
at org.jivesoftware.smackx.privacy.PrivacyListManager$1.connectionCreated(PrivacyListManager.java:81)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.initConnection(XMPPTCPConnection.java:636)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:834)
at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:365)
...
Caused by: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
at org.jivesoftware.smack.filter.FlexibleStanzaTypeFilter.<init>(FlexibleStanzaTypeFilter.java:40)
at org.jivesoftware.smackx.privacy.filter.SetActiveListFilter.<init>(SetActiveListFilter.java:27)
at org.jivesoftware.smackx.privacy.filter.SetActiveListFilter.<clinit>(SetActiveListFilter.java:25)
Any ideas on what proguard config would fix this?
Update: I already referred to the other issue in my report and explained that proposed solution is not a fix in this case.
Update 2: I have regenerated the stack trace with line numbers enabled.