本文介绍了aSmack错误:XMPPConnection是抽象的;无法实例化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在跟踪一个教程,以使用Android Studio制作一个非常基本的聊天应用程序,但出现错误:

I'm following a tutorial to make a very basic chat app with Android Studio, but I'm getting the error:

在以下行:

ConnectionConfiguration connConfig = new ConnectionConfiguration(HOST, PORT, SERVICE);
         XMPPConnection connection = new XMPPConnection(connConfig); 

当尝试使用XMPPConnection元素时,我还会收到一些未处理的异常".

And I'm also getting some "Unhandled exception" when trying to use XMPPConnection elements.

还链接到该教程: LINK

推荐答案

在Smack 4.0.0中看起来像这样.该文档仍未更新.

Looks like this changed in Smack 4.0.0. The documentation still has not been updated.

似乎他们将在Smack 4.1中再次对其进行更改:

And it looks like they will change it again in Smack 4.1:

What was     
Connection connection = new XMPPConnection()
is
XMPPConnection connection = new XMPPTCPConnection()
in Smack 4 and will become
AbstractXMPPConnection connection = new XMPPTCPConnection()
in Smack 4.1

请查看此链接: https://igniterealtime.org/issues/browse/SMACK-574

还有SMACK 4.0的升级指南: https://community.igniterealtime.org/docs/DOC-2703

There is also an upgrade guide for SMACK 4.0: https://community.igniterealtime.org/docs/DOC-2703

更新:

此外,看起来新的Smack 4.x库只能在Java 7及更高版本上运行.Java 6向后兼容性被破坏.

Also, looks like the new Smack 4.x libraries will only run with Java 7 and above. Java 6 backwards compatibility is broken.

这篇关于aSmack错误:XMPPConnection是抽象的;无法实例化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 19:15