gpt4 book ai didi

android - android 中的 XMPPConnection 错误

转载 作者:太空狗 更新时间:2023-10-29 15:49:08 26 4
gpt4 key购买 nike

我正在使用此链接中的相同代码 Google chat

但是我得到了以下错误。

04-12 09:13:55.903: ERROR/AndroidRuntime(362): FATAL EXCEPTION: Thread-8
04-12 09:13:55.903: ERROR/AndroidRuntime(362): java.lang.ExceptionInInitializerError
04-12 09:13:55.903: ERROR/AndroidRuntime(362): at org.jivesoftware.smack.ConnectionConfiguration.<init>(ConnectionConfiguration.java:99)
04-12 09:13:55.903: ERROR/AndroidRuntime(362): at org.jivesoftware.smack.XMPPConnection.<init>(XMPPConnection.java:131)
04-12 09:13:55.903: ERROR/AndroidRuntime(362): at com.ex.HelloFormStuffActivity.HelloFormStuffActivity$1.run(HelloFormStuffActivity.java:38)
04-12 09:13:55.903: ERROR/AndroidRuntime(362): at java.lang.Thread.run(Thread.java:1096)
04-12 09:13:55.903: ERROR/AndroidRuntime(362): Caused by: java.lang.NoClassDefFoundError: javax.naming.directory.InitialDirContext
04-12 09:13:55.903: ERROR/AndroidRuntime(362): at org.jivesoftware.smack.util.DNSUtil.<clinit>(DNSUtil.java:50)
04-12 09:13:55.903: ERROR/AndroidRuntime(362): ... 4 more

我不知道为什么会出现这个错误。谁能帮帮我?

最佳答案

ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com", 5222,"chat.facebook.com");

        XMPPConnection myConn = new XMPPConnection(config);
config.setSASLAuthenticationEnabled(true);
config.setDebuggerEnabled(true);

try{
myConn.connect();
//username is no @chat.facebook.com
myConn.login("rajeshXXXXX","XXXXXXX" );




}
catch (Exception e) {
System.out.println(e.toString());
}

//它终于对我有用了,使用 asmack-2010.05.07.jargit://gist.github.com/925250.git

关于android - android 中的 XMPPConnection 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5633243/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com