i start openFire and test it with spark everything is ok but when i try to connect with smack 4.2.0 in android studio i got this error:
Ljavax/naming/directory/InitialDirContext;
and my dependencies is this:
compile "org.igniterealtime.smack:smack-java7:4.2.0" compile
"org.igniterealtime.smack:smack-tcp:4.2.0" compile
"org.igniterealtime.smack:smack-im:4.2.0" compile
"org.igniterealtime.smack:smack-extensions:4.2.0" compile
"org.igniterealtime.smack:smack-android-extensions:4.2.0" compile
"org.igniterealtime.smack:smack-bosh:4.2.0"
when remove this :
"compile org.igniterealtime.smack:smack-java7:4.2.0"
from dependencies and add this:
compile "org.igniterealtime.smack:smack-android:4.2.0"
my dependencies become like this:
compile 'com.android.support:appcompat-v7:24.0.0' compile
"org.igniterealtime.smack:smack-android:4.2.0" compile
"org.igniterealtime.smack:smack-tcp:4.2.0" compile
"org.igniterealtime.smack:smack-im:4.2.0" compile
"org.igniterealtime.smack:smack-extensions:4.2.0" compile
"org.igniterealtime.smack:smack-android-extensions:4.2.0" compile
"org.igniterealtime.smack:smack-bosh:4.2.0"
I got This Error:
org.jivesoftware.smack.SmackException$ConnectionException: The
following addresses failed: '192.168.209.2:5222' failed because:
de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for
192.168.209.2. IN A yielded an error response NX_DOMAIN, '192.168.209.2:5222' failed because:
de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for
192.168.209.2. IN AAAA yielded an error response NX_DOMAIN
the part of code that make error when i try to conn.connect() is this:
XMPPTCPConnectionConfiguration config = null;
try {
config = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword("admin", "thepass")
.setXmppDomain("192.168.1.3")
.setHost("192.168.209.2")
.setPort(5222)
.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
.build();
} catch (Exception e) {
e.printStackTrace();
}
AbstractXMPPConnection conn1 = new XMPPTCPConnection(config);
conn1.setReplyTimeout(60000);
conn1.setPacketReplyTimeout(60000);
conn1.connect();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…