Hi
After upgrading gradle version to 7.3.3 and gradle plugin to 7.2.1 my app start to get this exception
java.lang.AssertionError
at org.jivesoftware.smack.AbstractXMPPConnection.sendStanza(AbstractXMPPConnection.java:686)
This is the relevant part in AbstractXMPPConnection.java:
@Override
public void sendStanza(Stanza stanza) throws NotConnectedException, InterruptedException {
Objects.requireNonNull(stanza, "Stanza must not be null");
assert (stanza instanceof Message || stanza instanceof Presence || stanza instanceof IQ);
My app only crashes when i upgrade gradle version and only in debug mode this happend so i searched and find this change and i think this is the problem
Assertions in debug builds
When you build the debug version of your app using Android Gradle plugin 4.1.0 and higher, the built-in compiler (D8) will rewrite your app’s code to enable assertions at compile time, so you always have assertion checks active.
So do you have any idea how i can prevent this problem?
Thanks
Next step would be to find out the type of the stanza instance that is triggering the assertion. To do so, attach a debugger, create a breakpoint for AssertionErrors and inspect the stanza insance that is causing the assertion to trigger to find out its type.
Well, Smack users are not supposed to create their own subclasses of Stanza. Smack provides sufficient extension interfaces allowing users to put “their” XML on the XMPP wire.