SASLErrorException: SASLError using DIGEST-MD5: not-authorized on Android

I want to study the IM on Android.

But this issue has troubled me for two days…

I used Smack-4.1.3.

I find the Smack-4.1.3 has just a little example…

My code:

try {
  XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration
  .builder()
  .setUsernameAndPassword("ye", "admin")
  .setServiceName("localhost")
  .setHost("192.168.2.108")
  .setPort(5222)
  .setSecurityMode(SecurityMode.disabled).build();
  AbstractXMPPConnection conn2 = new XMPPTCPConnection(config);
  conn2.connect();
  Log.e("TAG", String.valueOf(conn2.isConnected()));
  conn2.login();
  Log.e("TAG", "登录成功");
  return;
  } catch (SmackException e) {
  e.printStackTrace();
  Log.e("TAG", "登录失败");
  } catch (IOException e) {
  e.printStackTrace();
  Log.e("TAG", "登录失败");
  } catch (XMPPException e) {
  e.printStackTrace();
  Log.e("TAG", "登录失败");
  }
  }

and my LogCat:

07-23 16:03:24.486: E/TAG(9778): true 07-23 16:03:24.516: W/System.err(9778): org.jivesoftware.smack.sasl.SASLErrorException: SASLError using DIGEST-MD5: not-authorized 07-23 16:03:24.516: W/System.err(9778): at org.jivesoftware.smack.SASLAuthentication.authenticationFailed(SASLAuthenticati on.java:365) 07-23 16:03:24.516: W/System.err(9778): at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:1031) 07-23 16:03:24.516: W/System.err(9778): at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPCon nection.java:935) 07-23 16:03:24.516: W/System.err(9778): at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:950) 07-23 16:03:24.516: W/System.err(9778): at java.lang.Thread.run(Thread.java:841) 07-23 16:03:24.516: E/TAG(9778): 登录失败

This is my first question…

Thank you for your any help.

setServiceName(“localhost”)

Is ‘localhost’ really the service name/XMPP domain your XMPP service uses?

Thank you for your reply…

yes…

and I replaced “localhost” with “myreceiver” and “192.168.2.108” , but still so…

Haha. I solved the problem.

This is now.

This is old.

I deleted a few .jar ,and login successful now.

Thank you sincerely!!!