I am facing an issue with the library smack. I got an exception like below when I update to Android studio to 4.1 and Gradle to 6.5
Caused by: java.lang.AssertionError
at org.jivesoftware.smack.AbstractXMPPConnection.sendStanza(AbstractXMPPConnection.java:686)
at com.app.modules.rnxmpp.service.XmppServiceSmackImpl.sendStanza(XmppServiceSmackImpl.java:713)
at com.app.modules.rnxmpp.RNXMPPModule.sendStanza(RNXMPPModule.java:189)
Before 4.1 and Gradle 6.0.1, there is no error in the code nor any crash. This only happens when I update the studio and Gradle.
The error is causing by the code in the smack library
//org.jivesoftware.smack.AbstractXMPPConnection
@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);
throwNotConnectedExceptionIfAppropriate();
switch (fromMode) {
case OMITTED:
stanza.setFrom((Jid) null);
break;
case USER:
stanza.setFrom(getUser());
break;
case UNCHANGED:
default:
break;
}
// Invoke interceptors for the new stanza that is about to be sent. Interceptors may modify
// the content of the stanza.
firePacketInterceptors(stanza);
sendStanzaInternal(stanza);
}
There is an assert call in the library file called AbstractXMPPConnection
when I call this function I got a crash and the above stack trace is shown on the log. Does anyone know what happens here? Android studio version: 4.1 gradle https://services.gradle.org/distributions/gradle-6.5-bin.zip //smack library
implementation "org.igniterealtime.smack:smack-android-extensions:4.3.0"
implementation "org.igniterealtime.smack:smack-tcp:4.3.0"
implementation "org.igniterealtime.smack:smack-extensions:4.3.0"
implementation 'org.igniterealtime.smack:smack-sasl-provided:4.1.9'