0
我正在嘗試使用Smack庫建立XMPP連接。使用版本4.2.0-β2(咂嘴核)和4.1.8(咂嘴-TCP)線程「main」中的異常java.lang.NoSuchFieldError:ifpossible
public void gcmConnect()
{
try{
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder().setHost(GCM_SERVER)
.setPort(GCM_PORT).setUsernameAndPassword("[email protected]", API_KEY).build();
XMPPTCPConnection connection = new XMPPTCPConnection(config);
connection.connect();
System.out.println("Connected");
}
catch(XMPPException ex)
{
ex.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
XMPPConnectionTest obj = new XMPPConnectionTest();
obj.gcmConnect();
}
它提供了以下錯誤
Exception in thread "main" java.lang.NoSuchFieldError: ifpossible
at org.jivesoftware.smack.ConnectionConfiguration$Builder.<init>(ConnectionConfiguration.java:438)
at org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration$Builder.<init>(XMPPTCPConnectionConfiguration.java:91)
at org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration$Builder.<init>(XMPPTCPConnectionConfiguration.java:87)
at org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration.builder(XMPPTCPConnectionConfiguration.java:80)
at com.inn.foresight.gcm.XMPPConnectionTest.gcmConnect(XMPPConnectionTest.java:32)
at com.inn.foresight.gcm.XMPPConnectionTest.main(XMPPConnectionTest.java:53)
謝謝! :)在classpath中有一個問題。 –
隨時歡迎。請接受答案,如果它幫助:) –