I try to build an Android APP with smack.
I use Android Studio and gradle to build my APP.
I build Smack 4.4.7 with jdk1.8 and Gradle 6.8.3 in gradle/wrapper.
I build my APP with jdk 17.0.7 and Gradle 8.2.2
This is my APP’s build.gradle:
plugins {
id 'com.android.application'
}
android {
namespace 'cn.mydomain.smacksdktest'
compileSdk 34
defaultConfig {
applicationId "cn.mydomain.smacksdktest"
minSdk 24
targetSdk 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'org.jxmpp:jxmpp-core:1.0.3'
implementation 'org.jxmpp:jxmpp-jid:1.0.3'
implementation 'org.minidns:minidns-core:1.0.4'
implementation 'eu.geekplace.javapinning:java-pinning-java7:1.1.0-alpha1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
// smack
implementation files('libs/smack-core-4.4.7.jar')
implementation files('libs/smack-im-4.4.7.jar')
implementation files('libs/smack-tcp-4.4.7.jar')
implementation files('libs/smack-android-4.4.7.jar')
implementation files('libs/smack-xmlparser-4.4.7.jar')
// implementation files('libs/smack-xmlparser-stax-4.4.7.jar') // No response
implementation files('libs/smack-xmlparser-xpp3-4.4.7.jar') // works well
implementation files('libs/smack-streammanagement-4.4.7.jar')
implementation files('libs/smack-resolver-dnsjava-4.4.7.jar')
implementation files('libs/stax-api.jar')
implementation files('libs/com.bea.stax.impl_1.2.0.jar')
}
This is my code in Activy.java:
public void onButtonLoginClick(View view) {
Log.i("SDK", "on button login click 1");
Logger logger = Logger.getLogger("org.jivesoftware.smack");
logger.setLevel(Level.FINER);
ConsoleHandler handler = new ConsoleHandler();
handler.setLevel(Level.FINER);
logger.addHandler(handler);
new Thread(new Runnable() {
@Override
public void run() {
try {
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword("username", "onepasswd")
.setXmppDomain("tigase.mydomain.cn")
.setHost("tigase.mydomain.cn")
.enableDefaultDebugger()
.build();
AbstractXMPPConnection connection = new XMPPTCPConnection(config);
connection.connect();
connection.login();
Message message = connection.getStanzaFactory()
.buildMessageStanza()
.to("ackema@tigase.mydomain.cn")
.setBody("Howdy! How are you?")
.build();
connection.sendStanza(message);
Log.i("SDKTest", "after send");
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
If I use “libs/smack-xmlparser-xpp3-4.4.7.jar” in build.gradle, it works well:
2024-04-07 09:46:34.087 27399-27418 EGL_emulation cn.mydomain.smacksdktest D app_time_stats: avg=1529.47ms min=3.06ms max=15236.05ms count=10
2024-04-07 09:46:34.141 27399-27399 SDK cn.mydomain.smacksdktest I on button login click 1
2024-04-07 09:46:34.198 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.198 27399-27449 System.err cn.mydomain.smacksdktest W FINE: Loaded SmackInitializer org.jivesoftware.smack.initializer.VmArgInitializer
2024-04-07 09:46:34.206 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.206 27399-27449 System.err cn.mydomain.smacksdktest W FINE: Loaded org.jivesoftware.smack.ReconnectionManager
2024-04-07 09:46:34.211 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.212 27399-27449 System.err cn.mydomain.smacksdktest W FINE: A startup class 'org.jivesoftware.smack.util.dns.javax.JavaxResolver' could not be loaded.
2024-04-07 09:46:34.217 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.217 27399-27449 System.err cn.mydomain.smacksdktest W FINE: A startup class 'org.jivesoftware.smack.util.dns.minidns.MiniDnsResolver' could not be loaded.
2024-04-07 09:46:34.235 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.235 27399-27449 System.err cn.mydomain.smacksdktest W FINE: Loaded SmackInitializer org.jivesoftware.smack.util.dns.dnsjava.DNSJavaResolver
2024-04-07 09:46:34.242 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.243 27399-27449 System.err cn.mydomain.smacksdktest W FINE: A startup class 'org.jivesoftware.smack.extensions.ExtensionsInitializer' could not be loaded.
2024-04-07 09:46:34.246 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.246 27399-27449 System.err cn.mydomain.smacksdktest W FINE: A startup class 'org.jivesoftware.smack.experimental.ExperimentalInitializer' could not be loaded.
2024-04-07 09:46:34.252 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.253 27399-27449 System.err cn.mydomain.smacksdktest W FINE: A startup class 'org.jivesoftware.smack.legacy.LegacyInitializer' could not be loaded.
2024-04-07 09:46:34.262 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.initializer.UrlInitializer initialize
2024-04-07 09:46:34.262 27399-27449 System.err cn.mydomain.smacksdktest W FINE: Loading providers for providerUri [classpath:org.jivesoftware.smack.tcp/smacktcp.providers]
2024-04-07 09:46:34.279 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.279 27399-27449 System.err cn.mydomain.smacksdktest W FINE: Loaded SmackInitializer org.jivesoftware.smack.tcp.TCPInitializer
2024-04-07 09:46:34.285 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.285 27399-27449 System.err cn.mydomain.smacksdktest W FINE: A startup class 'org.jivesoftware.smack.sasl.javax.SASLJavaXSmackInitializer' could not be loaded.
2024-04-07 09:46:34.291 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.291 27399-27449 System.err cn.mydomain.smacksdktest W FINE: A startup class 'org.jivesoftware.smack.sasl.provided.SASLProvidedSmackInitializer' could not be loaded.
2024-04-07 09:46:34.300 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.300 27399-27449 System.err cn.mydomain.smacksdktest W FINE: Loaded SmackInitializer org.jivesoftware.smack.android.AndroidSmackInitializer
2024-04-07 09:46:34.306 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.306 27399-27449 System.err cn.mydomain.smacksdktest W FINE: A startup class 'org.jivesoftware.smack.java7.Java7SmackInitializer' could not be loaded.
2024-04-07 09:46:34.315 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.initializer.UrlInitializer initialize
2024-04-07 09:46:34.316 27399-27449 System.err cn.mydomain.smacksdktest W FINE: Loading providers for providerUri [classpath:org.jivesoftware.smack.im/smackim.providers]
2024-04-07 09:46:34.350 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.350 27399-27449 System.err cn.mydomain.smacksdktest W FINE: Loaded org.jivesoftware.smack.roster.Roster
2024-04-07 09:46:34.354 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.354 27399-27449 System.err cn.mydomain.smacksdktest W FINE: Loaded SmackInitializer org.jivesoftware.smack.im.SmackImInitializer
2024-04-07 09:46:34.359 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.359 27399-27449 System.err cn.mydomain.smacksdktest W FINE: A startup class 'org.jivesoftware.smackx.omemo.OmemoInitializer' could not be loaded.
2024-04-07 09:46:34.362 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.SmackInitialization loadSmackClass
2024-04-07 09:46:34.362 27399-27449 System.err cn.mydomain.smacksdktest W FINE: A startup class 'org.jivesoftware.smackx.ox.util.OpenPgpInitializer' could not be loaded.
2024-04-07 09:46:34.440 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.debugger.ReflectionDebuggerFactory getOneOfDefaultDebuggerClasses
2024-04-07 09:46:34.440 27399-27449 System.err cn.mydomain.smacksdktest W FINE: Did not find debugger class 'org.jivesoftware.smackx.debugger.EnhancedDebugger'
2024-04-07 09:46:34.468 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.tcp.XMPPTCPConnection connectUsingConfiguration
2024-04-07 09:46:34.468 27399-27449 System.err cn.mydomain.smacksdktest W FINER: Trying to establish TCP connection to tigase.mydomain.cn/101.132.109.2:5222
2024-04-07 09:46:34.472 27399-27457 TrafficStats cn.mydomain.smacksdktest D tagSocket(104) with statsTag=0xffffffff, statsUid=-1
2024-04-07 09:46:34.511 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.tcp.XMPPTCPConnection connectUsingConfiguration
2024-04-07 09:46:34.512 27399-27449 System.err cn.mydomain.smacksdktest W FINER: Established TCP connection to tigase.mydomain.cn/101.132.109.2:5222
2024-04-07 09:46:34.521 27399-27458 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter$1 run
2024-04-07 09:46:34.521 27399-27458 System.err cn.mydomain.smacksdktest W FINER: Smack Writer (0) start
2024-04-07 09:46:34.523 27399-27459 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:34 AM org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1 run
2024-04-07 09:46:34.524 27399-27459 System.err cn.mydomain.smacksdktest W FINER: Smack Reader (0) start
2024-04-07 09:46:34.531 27399-27458 SMACK cn.mydomain.smacksdktest D SENT (0):
<stream:stream xmlns='jabber:client' to='tigase.mydomain.cn' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='username@tigase.mydomain.cn' xml:lang='en-US'>
2024-04-07 09:46:34.549 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0): ?xml version='1.0'?>
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='tigase.mydomain.cn' id='c7d84abc-63e9-4594-83d6-cccc8ea55204' version='1.0' xml:lang='en'>
2024-04-07 09:46:34.612 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0):
<stream:features>
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
<required/>
</starttls>
<compression xmlns="http://jabber.org/features/compress">
<method>
zlib
</method>
</compression>
</stream:features>
2024-04-07 09:46:34.617 27399-27458 SMACK cn.mydomain.smacksdktest D SENT (0):
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
2024-04-07 09:46:34.631 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0):
<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
2024-04-07 09:46:34.728 27399-27458 SMACK cn.mydomain.smacksdktest D SENT (0):
<stream:stream xmlns='jabber:client' to='tigase.mydomain.cn' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='username@tigase.mydomain.cn' id='c7d84abc-63e9-4594-83d6-cccc8ea55204' xml:lang='en-US'>
2024-04-07 09:46:34.755 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0): ?xml version='1.0'?>
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='tigase.mydomain.cn' id='c7d84abc-63e9-4594-83d6-cccc8ea55204' version='1.0' xml:lang='en'>
2024-04-07 09:46:34.761 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0):
<stream:features>
<auth xmlns="http://jabber.org/features/iq-auth"/>
<register xmlns="http://jabber.org/features/iq-register"/>
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<mechanism>
SCRAM-SHA-256
</mechanism>
<mechanism>
SCRAM-SHA-1
</mechanism>
<mechanism>
PLAIN
</mechanism>
<mechanism>
ANONYMOUS
</mechanism>
</mechanisms>
<compression xmlns="http://jabber.org/features/compress">
<method>
zlib
</method>
</compression>
</stream:features>
2024-04-07 09:46:34.769 27399-27458 SMACK cn.mydomain.smacksdktest D SENT (0):
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='SCRAM-SHA-1'>
biwsbj1tYXh1bWluZyxyPTphdnJvWzVbaDIuc2ZSdmJUQGlRXiQ1UGEld2BLZSd6
</auth>
2024-04-07 09:46:34.789 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0):
<challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
cj06YXZyb1s1W2gyLnNmUnZiVEBpUV4kNVBhJXdgS2UnekVicmNBM291VkdVb0VQbjl3MGk2LHM9MWg4Vmx3Z2NFZUlpWFE9PSxpPTQwOTY=
</challenge>
2024-04-07 09:46:35.012 27399-27458 SMACK cn.mydomain.smacksdktest D SENT (0):
<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
Yz1iaXdzLHI9OmF2cm9bNVtoMi5zZlJ2YlRAaVFeJDVQYSV3YEtlJ3pFYnJjQTNvdVZHVW9FUG45dzBpNixwPUhXZTVCODlnNDAxYnFzY1RPWndnaGJoVFpTdz0=
</response>
2024-04-07 09:46:35.027 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0):
<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
dj0xUmJXSldzWEVHQUZ5bVZ5L3F4VnpvbVQ4dEU9
</success>
2024-04-07 09:46:35.030 27399-27458 SMACK cn.mydomain.smacksdktest D SENT (0):
<stream:stream xmlns='jabber:client' to='tigase.mydomain.cn' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='username@tigase.mydomain.cn' id='c7d84abc-63e9-4594-83d6-cccc8ea55204' xml:lang='en-US'>
2024-04-07 09:46:35.052 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0): ?xml version='1.0'?>
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='tigase.mydomain.cn' id='c7d84abc-63e9-4594-83d6-cccc8ea55204' version='1.0' xml:lang='en'>
2024-04-07 09:46:35.113 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0):
<stream:features>
<sm xmlns="urn:xmpp:sm:3"/>
<register xmlns="http://jabber.org/features/iq-register"/>
<csi xmlns="urn:xmpp:csi:0"/>
<ver xmlns="urn:xmpp:features:rosterver"/>
<sub xmlns="urn:xmpp:features:pre-approval"/>
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/>
<session xmlns="urn:ietf:params:xml:ns:xmpp-session">
<optional/>
</session>
<c ver="hzyBIlUEYjx9jlFhAus3AbCjy5Y=" xmlns="http://jabber.org/protocol/caps" node="https://tigase.net/tigase-xmpp-server" hash="SHA-1"/>
</stream:features>
2024-04-07 09:46:35.119 27399-27449 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:35 AM org.jivesoftware.smack.AbstractXMPPConnection bindResourceAndEstablishSession
2024-04-07 09:46:35.119 27399-27449 System.err cn.mydomain.smacksdktest W FINER: Waiting for last features to be received before continuing with resource binding
2024-04-07 09:46:35.129 27399-27458 SMACK cn.mydomain.smacksdktest D SENT (0):
<iq id='M6FHE-1' type='set'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
</bind>
</iq>
2024-04-07 09:46:35.149 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0):
<iq xmlns="jabber:client" type="result" to="username@tigase.mydomain.cn/1423222896-tigase-58" id="M6FHE-1">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<jid>
username@tigase.mydomain.cn/1423222896-tigase-58
</jid>
</bind>
</iq>
2024-04-07 09:46:35.157 27399-27458 SMACK cn.mydomain.smacksdktest D SENT (0):
<enable xmlns='urn:xmpp:sm:3' resume='true'/>
2024-04-07 09:46:35.176 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0):
<enabled xmlns='urn:xmpp:sm:3' id='a64f7d50-6b52-4fcb-8e49-dc7a2a36c8e5' resume='true' max='60' location='ackema' />
2024-04-07 09:46:35.178 27399-27449 SMACK cn.mydomain.smacksdktest D User logged (0): username@tigase.mydomain.cn:5222/1423222896-tigase-58
2024-04-07 09:46:35.183 27399-27449 Compatibil...geReporter cn.mydomain.smacksdktest D Compat change id reported: 289878283; UID 10193; state: ENABLED
2024-04-07 09:46:35.184 27399-27449 SMACK cn.mydomain.smacksdktest D XMPPConnection authenticated (XMPPTCPConnection[username@tigase.mydomain.cn/1423222896-tigase-58] (0))
2024-04-07 09:46:35.186 27399-27458 SMACK cn.mydomain.smacksdktest D SENT (0):
<iq id='M6FHE-3' type='get'>
<query xmlns='jabber:iq:roster'>
</query>
</iq>
2024-04-07 09:46:35.189 27399-27458 SMACK cn.mydomain.smacksdktest D SENT (0):
<presence id='246J5-1'/>
2024-04-07 09:46:35.194 27399-27449 SDKTest cn.mydomain.smacksdktest I after send
2024-04-07 09:46:35.196 27399-27458 SMACK cn.mydomain.smacksdktest D SENT (0):
<message to='ackema@tigase.mydomain.cn' id='246J5-2'>
<body>
Howdy! How are you?
</body>
</message>
<r xmlns='urn:xmpp:sm:3'/>
2024-04-07 09:46:35.199 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0):
<iq xmlns="jabber:client" type="result" to="username@tigase.mydomain.cn/1423222896-tigase-58" id="M6FHE-3">
<query xmlns="jabber:iq:roster"/>
</iq>
2024-04-07 09:46:35.204 27399-27461 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:46:35 AM org.jivesoftware.smack.roster.Roster$RosterResultListener onSuccess
2024-04-07 09:46:35.204 27399-27461 System.err cn.mydomain.smacksdktest W FINE: RosterResultListener received IQ Stanza (query jabber:iq:roster) [to=username@tigase.mydomain.cn/1423222896-tigase-58,id=M6FHE-3,type=result,]
2024-04-07 09:46:35.251 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0):
<presence from="username@tigase.mydomain.cn/1423222896-tigase-57" id="9UZWI-1" xmlns="jabber:client" to="username@tigase.mydomain.cn"/>
2024-04-07 09:46:35.253 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0):
<presence from="username@tigase.mydomain.cn/1423222896-tigase-58" id="246J5-1" xmlns="jabber:client" to="username@tigase.mydomain.cn"/>
2024-04-07 09:46:35.255 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0):
<a xmlns='urn:xmpp:sm:3' h='3'/>
2024-04-07 09:46:40.188 27399-27453 bc.smacksdktest cn.mydomain.smacksdktest W Long monitor contention with owner Smack DefaultReactor Thread #0 (27452) at int sun.nio.ch.SelectorImpl.lockAndDoSelect(long)(SelectorImpl.java:86) waiters=0 in void org.jivesoftware.smack.SmackReactor$Reactor.handleScheduledActionsOrPerformSelect() for 5.754s
2024-04-07 09:47:17.379 27399-27459 SMACK cn.mydomain.smacksdktest D RECV (0):
<presence type="unavailable" xmlns="jabber:client" from="username@tigase.mydomain.cn/1423222896-tigase-57" to="username@tigase.mydomain.cn/1423222896-tigase-58"/>
However, if I use “libs/smack-xmlparser-stax-4.4.7.jar” in build.gradle, the logcat print:
2024-04-07 09:52:28.242 27544-27572 EGL_emulation cn.mydomain.smacksdktest D app_time_stats: avg=512.10ms min=2.35ms max=5058.94ms count=10
2024-04-07 09:52:28.272 27544-27544 SDK cn.mydomain.smacksdktest I on button login click 1
// I deleted some logs here
2024-04-07 09:52:28.678 27544-27611 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:52:28 AM org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter$1 run
2024-04-07 09:52:28.678 27544-27611 System.err cn.mydomain.smacksdktest W FINER: Smack Writer (0) start
2024-04-07 09:52:28.680 27544-27612 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:52:28 AM org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1 run
2024-04-07 09:52:28.681 27544-27612 System.err cn.mydomain.smacksdktest W FINER: Smack Reader (0) start
2024-04-07 09:52:28.693 27544-27611 SMACK cn.mydomain.smacksdktest D SENT (0):
<stream:stream xmlns='jabber:client' to='tigase.mydomain.cn' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='username@tigase.mydomain.cn' xml:lang='en-US'>
2024-04-07 09:52:28.707 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0): ?xml v
2024-04-07 09:52:28.707 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0): ersion=
2024-04-07 09:52:28.709 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0): '1.0'?>
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='tigase.mydomain.cn' id='4c5927cb-fa4a-46f4-8c0d-7a7dfc20b591' version='1.0' xml:lang='en'>
2024-04-07 09:52:28.763 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0):
<stream:features>
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
<required/>
</starttls>
<compression xmlns="http://jabber.org/features/compress">
<method>
zlib
</method>
</compression>
</stream:features>
2024-04-07 09:52:28.768 27544-27611 SMACK cn.mydomain.smacksdktest D SENT (0):
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
2024-04-07 09:52:28.782 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0):
<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
2024-04-07 09:52:28.899 27544-27611 SMACK cn.mydomain.smacksdktest D SENT (0):
<stream:stream xmlns='jabber:client' to='tigase.mydomain.cn' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='username@tigase.mydomain.cn' xml:lang='en-US'>
2024-04-07 09:52:28.974 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0): ?xml v
2024-04-07 09:52:28.975 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0): ersion=
2024-04-07 09:52:28.976 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0): '1.0'?>
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='tigase.mydomain.cn' id='4c5927cb-fa4a-46f4-8c0d-7a7dfc20b591' version='1.0' xml:lang='en'>
2024-04-07 09:52:28.980 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0):
<stream:features>
<auth xmlns="http://jabber.org/features/iq-auth"/>
<register xmlns="http://jabber.org/features/iq-register"/>
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<mechanism>
SCRAM-SHA-256
</mechanism>
<mechanism>
SCRAM-SHA-1
</mechanism>
<mechanism>
PLAIN
</mechanism>
<mechanism>
ANONYMOUS
</mechanism>
</mechanisms>
<compression xmlns="http://jabber.org/features/compress">
<method>
zlib
</method>
</compression>
</stream:features>
2024-04-07 09:52:28.988 27544-27611 SMACK cn.mydomain.smacksdktest D SENT (0):
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='SCRAM-SHA-1'>
biwsbj1tYXh1bWluZyxyPVBdOjZUQTNrW3EkRXFBNW5bdkV4KUx8VUJXJy06aWJC
</auth>
2024-04-07 09:52:29.002 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0):
<challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
cj1QXTo2VEEza1txJEVxQTVuW3ZFeClMfFVCVyctOmliQmpNcGRXRkp3eGFzWkt2d0lFQVYyLHM9MWg4Vmx3Z2NFZUlpWFE9PSxpPTQwOTY=
</challenge>
2024-04-07 09:52:29.380 27544-27611 SMACK cn.mydomain.smacksdktest D SENT (0):
<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
Yz1iaXdzLHI9UF06NlRBM2tbcSRFcUE1blt2RXgpTHxVQlcnLTppYkJqTXBkV0ZKd3hhc1pLdndJRUFWMixwPUFLcWZjVldqUCtmcUhaVjZCRGkza3Z5dnlwMD0=
</response>
2024-04-07 09:52:29.398 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0):
<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
dj16bm10NVdOYmFXZElHcnlzaXc4UFVYZVVUTm89
</success>
2024-04-07 09:52:29.401 27544-27611 SMACK cn.mydomain.smacksdktest D SENT (0):
<stream:stream xmlns='jabber:client' to='tigase.mydomain.cn' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='username@tigase.mydomain.cn' xml:lang='en-US'>
2024-04-07 09:52:29.419 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0): ?xml v
2024-04-07 09:52:29.419 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0): ersion=
2024-04-07 09:52:29.422 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0): '1.0'?>
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='tigase.mydomain.cn' id='4c5927cb-fa4a-46f4-8c0d-7a7dfc20b591' version='1.0' xml:lang='en'>
2024-04-07 09:52:29.478 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0):
<stream:features>
<sm xmlns="urn:xmpp:sm:3"/>
<register xmlns="http://jabber.org/features/iq-register"/>
<csi xmlns="urn:xmpp:csi:0"/>
<ver xmlns="urn:xmpp:features:rosterver"/>
<sub xmlns="urn:xmpp:features:pre-approval"/>
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/>
<session xmlns="urn:ietf:params:xml:ns:xmpp-session">
<optional/>
</session>
<c ver="hzyBIlUEYjx9jlFhAus3AbCjy5Y=" xmlns="http://jabber.org/protocol/caps" node="https://tigase.net/tigase-xmpp-server" hash="SHA-1"/>
</stream:features>
2024-04-07 09:52:29.483 27544-27602 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:52:29 AM org.jivesoftware.smack.AbstractXMPPConnection bindResourceAndEstablishSession
2024-04-07 09:52:29.483 27544-27602 System.err cn.mydomain.smacksdktest W FINER: Waiting for last features to be received before continuing with resource binding
2024-04-07 09:52:29.493 27544-27611 SMACK cn.mydomain.smacksdktest D SENT (0):
<iq id='3QLCH-1' type='set'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
</bind>
</iq>
2024-04-07 09:52:29.512 27544-27612 SMACK cn.mydomain.smacksdktest D RECV (0):
<iq xmlns="jabber:client" type="result" to="username@tigase.mydomain.cn/1423222896-tigase-59" id="3QLCH-1">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<jid>
username@tigase.mydomain.cn/1423222896-tigase-59
</jid>
</bind>
</iq>
2024-04-07 09:52:34.493 27544-27602 System.err cn.mydomain.smacksdktest W org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). StanzaCollector has been cancelled. Waited for response using: StanzaIdFilter: id=3QLCH-1.
2024-04-07 09:52:34.494 27544-27602 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:281)
2024-04-07 09:52:34.494 27544-27612 bc.smacksdktest cn.mydomain.smacksdktest W Long monitor contention with owner Thread-2 (27602) at void org.jivesoftware.smack.tcp.XMPPTCPConnection.loginInternal(java.lang.String, java.lang.String, org.jxmpp.jid.parts.Resourcepart)(XMPPTCPConnection.java:378) waiters=0 in void org.jivesoftware.smack.tcp.XMPPTCPConnection.instantShutdown() for 4.979s
2024-04-07 09:52:34.494 27544-27602 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:228)
2024-04-07 09:52:34.495 27544-27602 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.AbstractXMPPConnection.bindResourceAndEstablishSession(AbstractXMPPConnection.java:755)
2024-04-07 09:52:34.495 27544-27602 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.tcp.XMPPTCPConnection.loginInternal(XMPPTCPConnection.java:432)
2024-04-07 09:52:34.495 27544-27602 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:637)
2024-04-07 09:52:34.496 27544-27602 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:594)
2024-04-07 09:52:34.497 27544-27602 System.err cn.mydomain.smacksdktest W at cn.mydomain.smacksdktest.MainActivity$1.run(MainActivity.java:61)
2024-04-07 09:52:34.497 27544-27602 System.err cn.mydomain.smacksdktest W at java.lang.Thread.run(Thread.java:1012)
2024-04-07 09:52:34.502 27544-27612 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:52:34 AM org.jivesoftware.smack.tcp.XMPPTCPConnection shutdown
2024-04-07 09:52:34.502 27544-27612 System.err cn.mydomain.smacksdktest W FINER: Smack Writer (0) shutdown()
2024-04-07 09:52:34.505 27544-27612 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:52:34 AM org.jivesoftware.smack.tcp.XMPPTCPConnection shutdown
2024-04-07 09:52:34.505 27544-27612 System.err cn.mydomain.smacksdktest W FINER: Smack Writer (0) shutdown() returned
2024-04-07 09:52:34.508 27544-27611 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:52:34 AM org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter$1 run
2024-04-07 09:52:34.508 27544-27611 System.err cn.mydomain.smacksdktest W FINER: Smack Writer (0) exit
2024-04-07 09:52:34.509 27544-27612 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:52:34 AM org.jivesoftware.smack.tcp.XMPPTCPConnection shutdown
2024-04-07 09:52:34.509 27544-27612 System.err cn.mydomain.smacksdktest W FINER: Smack Reader (0) shutdown()
2024-04-07 09:52:34.511 27544-27612 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:52:34 AM org.jivesoftware.smack.tcp.XMPPTCPConnection shutdown
2024-04-07 09:52:34.511 27544-27612 System.err cn.mydomain.smacksdktest W FINER: Smack Reader (0) shutdown() returned
2024-04-07 09:52:34.517 27544-27612 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:52:34 AM org.jivesoftware.smack.tcp.XMPPTCPConnection shutdown
2024-04-07 09:52:34.517 27544-27612 System.err cn.mydomain.smacksdktest W FINE: Reader and writer threads terminated
2024-04-07 09:52:34.534 27544-27612 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:52:34 AM org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1 run
2024-04-07 09:52:34.534 27544-27612 System.err cn.mydomain.smacksdktest W FINER: Smack Reader (0) exit
2024-04-07 09:52:34.545 27544-27614 System.err cn.mydomain.smacksdktest W Apr 07, 2024 1:52:34 AM org.jivesoftware.smack.AbstractXMPPConnection callConnectionClosedOnErrorListener
2024-04-07 09:52:34.545 27544-27614 System.err cn.mydomain.smacksdktest W WARNING: Connection XMPPTCPConnection[not-authenticated] (0) closed with error
2024-04-07 09:52:34.545 27544-27614 System.err cn.mydomain.smacksdktest W java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase(java.util.Locale)' on a null object reference
2024-04-07 09:52:34.545 27544-27614 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.packet.IQ$Type.fromString(IQ.java:344)
2024-04-07 09:52:34.545 27544-27614 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.util.PacketParserUtils.parseIqData(PacketParserUtils.java:514)
2024-04-07 09:52:34.545 27544-27614 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:537)
2024-04-07 09:52:34.545 27544-27614 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.java:113)
2024-04-07 09:52:34.545 27544-27614 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMPPConnection.java:1455)
2024-04-07 09:52:34.546 27544-27614 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$1000(XMPPTCPConnection.java:131)
2024-04-07 09:52:34.546 27544-27614 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:973)
2024-04-07 09:52:34.547 27544-27614 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$700(XMPPTCPConnection.java:916)
2024-04-07 09:52:34.547 27544-27614 System.err cn.mydomain.smacksdktest W at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:939)
2024-04-07 09:52:34.547 27544-27614 System.err cn.mydomain.smacksdktest W at java.lang.Thread.run(Thread.java:1012)
2024-04-07 09:52:34.548 27544-27614 System.err cn.mydomain.smacksdktest W
2024-04-07 09:52:34.550 27544-27614 AbstractXMPPConnection cn.mydomain.smacksdktest W Connection XMPPTCPConnection[not-authenticated] (0) closed with error
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase(java.util.Locale)' on a null object reference
at org.jivesoftware.smack.packet.IQ$Type.fromString(IQ.java:344)
at org.jivesoftware.smack.util.PacketParserUtils.parseIqData(PacketParserUtils.java:514)
at org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:537)
at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.java:113)
at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMPPConnection.java:1455)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$1000(XMPPTCPConnection.java:131)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:973)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$700(XMPPTCPConnection.java:916)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:939)
at java.lang.Thread.run(Thread.java:1012)
2024-04-07 09:52:34.621 27544-27554 bc.smacksdktest cn.mydomain.smacksdktest I Background concurrent copying GC freed 94837(4144KB) AllocSpace objects, 19(380KB) LOS objects, 49% free, 4850KB/9700KB, paused 723us,46us total 127.865ms
By the way:
- I changed the domain, username, password in the code and logcat.