Search code examples
javaxmppsmack

Smack xmpp - Establishing a Connection


I just followed the getting started codes of Smack Xmpp 4.2.4 and I encountered this error. I was able to import the jar files needed. Can anyone help me? Here are the errors.

The type org.jxmpp.stringprep.XmppStringprepException cannot be resolved. It is indirectly referenced from required .class files The method setXmppDomain(String) from the type ConnectionConfiguration.Builder refers to the missing type XmppStringprepException

Getting started code that I followed

    XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
      .setUsernameAndPassword("username", "password")
      .setXmppDomain("192.168.0.1")
      .setPort("5222")
      .build();

    AbstractXMPPConnection con = new XMPPTCPConnection(config);
    con.connect().login();

Solution

  • You have to put the jxmpp-core, jxmpp-util-cache,jxmpp-jid JAR files into your project. JXMPP Github You may have other issues later, better read Smack4.2 Readme.