我正在使用Samck 4.1.0-Alpha库来创建Xmpp客户端.我创建了有效的用户.我试图通过代码发送消息.但得到错误.
代码:
new Runnable(){ @OverrIDe public voID run() { // Todo auto-generated method stub ConnectionConfiguration config = new ConnectionConfiguration("jabb3r.org", 5222, "jabb3r.org"); XMPPConnection connection = new XMPPTCPConnection(config); try { connection.connect(); connection.login("USERname", "PASSWORD"); // Assume we've created a XMPPConnection name "connection"._ ChatManager chatmanager = ChatManager.getInstanceFor(connection); Chat newChat = chatmanager.createChat("neilneil@jabb3r.org", new MessageListener() { public voID processMessage(Chat chat, Message message) { System.out.println("Received message: " + message); } }); try { newChat.sendMessage("Howdy!"); } catch (XMPPException e) { System.out.println("Error Delivering block"); }// connectionexception.getFailedAddresses(); } catch (SmackException | IOException | XMPPException e) { // Todo auto-generated catch block e.printstacktrace(); } } };
我收到这个奇怪的错误.
日志:
11-06 06:55:47.913: E/AndroIDRuntime(1604): FATAL EXCEPTION: Thread-11511-06 06:55:47.913:E/AndroIDRuntime(1604):java.lang.NoClassDefFoundError:org.xbill.DNS.ResolverConfig11-06 06:55:47.913: E/AndroIDRuntime(1604): at org.jivesoftware.smack.SmackAndroID.run(SmackAndroID.java:41)
我找不到调试此错误的资源.
解决方法:
https://community.igniterealtime.org/thread/49329
(Make sure to read the README or it wont work!)
https://github.com/Flowdalic/asmack/blob/master/README.asmack
Smack requires dnsjava for DNS SRV record lookup. You need to add thednsjava library to your project's librarIEs.
http://www.dnsjava.org/download/
总结以上是内存溢出为你收集整理的无法在android中的xmpp服务器中连接全部内容,希望文章能够帮你解决无法在android中的xmpp服务器中连接所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)