初学者aSmack错误 [英] Begginer aSmack error
问题描述
所以我跟随着一个教程,使一个与Android工作室非常基本的聊天应用程序,但我得到的错误:
So I'm followin a tutorial to make a very basic chat app with Android Studio, but I'm getting the error:
错误:(131,45)错误:XMPPConnection是抽象的;不可能 实例
Error:(131, 45) error: XMPPConnection is abstract; cannot be instantiated
在下面一行:
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
推荐答案
看起来啪4.0.0这样的改变。该文件还没有被更新。
Looks like this changed in Smack 4.0.0. The documentation still has not been updated.
和它看起来像他们将在拍击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
请参阅此链接:<一href="https://igniterealtime.org/issues/browse/SMACK-574">https://igniterealtime.org/issues/browse/SMACK-574
还有用于SMACK 4.0升级指南:<一href="https://community.igniterealtime.org/docs/DOC-2703">https://community.igniterealtime.org/docs/DOC-2703
There is also an upgrade guide for SMACK 4.0: https://community.igniterealtime.org/docs/DOC-2703
更新:
此外,看起来像新的拍击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错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!