简体   繁体   English

Smack xmpp-建立连接

[英]Smack xmpp - Establishing a Connection

I just followed the getting started codes of Smack Xmpp 4.2.4 and I encountered this error. 我只是遵循Smack Xmpp 4.2.4的入门代码,却遇到了此错误。 I was able to import the jar files needed. 我能够导入所需的jar文件。 Can anyone help me? 谁能帮我? Here are the errors. 这是错误。

The type org.jxmpp.stringprep.XmppStringprepException cannot be resolved. 无法解析类型org.jxmpp.stringprep.XmppStringprepException。 It is indirectly referenced from required .class files The method setXmppDomain(String) from the type ConnectionConfiguration.Builder refers to the missing type XmppStringprepException 从所需的.class文件中间接引用它。ConnectionConfiguration.Builder类型的setXmppDomain(String)方法引用缺少的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();

You have to put the jxmpp-core, jxmpp-util-cache,jxmpp-jid JAR files into your project. 您必须将jxmpp-core,jxmpp-util-cache,jxmpp-jid JAR文件放入项目中。 JXMPP Github You may have other issues later, better read Smack4.2 Readme . JXMPP Github以后可能还会有其他问题,最好阅读Smack4.2自述文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM