aSmack错误:XMPPConnection是抽象的; 无法实例化

zer*_*one 4 android smack asmack

我正在按照教程与Android Studio制作一个非常基本的聊天应用程序,但我收到错误:

错误:(131,45)错误:XMPPConnection是抽象的; 无法实例化

在以下行:

ConnectionConfiguration connConfig = new ConnectionConfiguration(HOST, PORT, SERVICE);
         XMPPConnection connection = new XMPPConnection(connConfig); 
Run Code Online (Sandbox Code Playgroud)

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

还链接到教程:LINK

Jos*_*ose 9

看起来这在Smack 4.0.0中发生了变化.文档仍未更新.

看起来他们会在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
Run Code Online (Sandbox Code Playgroud)

请参阅此链接:https://igniterealtime.org/issues/browse/SMACK-574

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

更新:

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