AnsweredAssumed Answered

Please provide working proguard config for Android

Question asked by Steve on Jul 1, 2015

I am trying to migrate from the old asmack to the shiny new smack 4.1.2, making use of the smack-android module.

My app is working perfectly... until it's time to generate a release version.

 

The release version uses proguard to minify the compiled app. This has consequences for especially where libraries use reflection or class loading at runtime. So what's needed is a working proguard config for smack.

 

I have tried the blanket solution suggested in http://stackoverflow.com/questions/29678908/what-are-the-recommended-proguard-ru les-for-smack-4-1 to no avail.

Upon connection to the XMPP server, the app immediately crashes, here is the 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)

The problem is also described in detail at

http://stackoverflow.com/questions/31157616/smack-for-android-fails-when-using-p roguard

Outcomes