小编Tai*_*han的帖子

Smack 4.1 SASL身份验证错误

我正在使用Smack 4.1本机库为Android开发聊天应用程序.我能够在我的应用程序和我的服务器之间建立连接,但我在登录时遇到有关SASL身份验证的SmackException.

需要注意的要点.

  1. 我的服务器端不需要SASL身份验证.
  2. 我的应用程序没有崩溃,但得到以下错误,我在下面的日志猫snnippet中显示.

我正在使用eclipse Luna和JDK 1.7版,我在libs文件夹中包含了以下库.

  1. jxmpp核-0.4.1
  2. jxmpp-UTIL缓存-0.4.1
  3. minidns-0.1.1
  4. 咂嘴,Android的4.1.0.jar
  5. 咂嘴,Android系统的扩展 - 4.1.0
  6. 嫌核心-4.1.0
  7. 咂嘴的扩展-4.1.0
  8. 嫌-IM-4.1.0
  9. 嫌-TCP-4.1.0

这是我用来建立连接的代码.

XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
        configBuilder.setUsernameAndPassword(userName, pass);
        configBuilder.setSecurityMode(XMPPTCPConnectionConfiguration.SecurityMode.disabled);
        configBuilder.setResource("testServices");
        configBuilder.setServiceName(DOMAIN);
        configBuilder.setPort(PORT);
        configBuilder.setHost(DOMAIN);
        configBuilder.setDebuggerEnabled(true);

        AbstractXMPPConnection connection = new XMPPTCPConnection(
                configBuilder.build());

        /** Connecting to the server */
        try {
            connection.connect();
            Log.i(TAG, "Connected to " + connection.getHost());
        } catch (SmackException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (XMPPException e) {
            Log.e(TAG, "Failed to connect to " + connection.getHost());
            Log.e(TAG, e.toString()); …
Run Code Online (Sandbox Code Playgroud)

eclipse android xmpp smack

4
推荐指数
1
解决办法
4214
查看次数

标签 统计

android ×1

eclipse ×1

smack ×1

xmpp ×1