Error : XMPPTCPConnectionConfiguration.builder() hangs in Android Smack 4.2.0-alpha1

Hi everyone,

I’m new to Smack and my sample code hangs at XMPPTCPConnectionConfiguration.builder().

Can anyone help me ?

  1. Environment :
  • Android Studio

  • Android Smack 4.2.0-alpha1

. I have copied the source code from the Maven Central Repository and used source code instead of jar files.

The related jar files are as follows.

external_lib.png

The final jar files that are as follows.

external_src.png

2-1) A simple ActionBarActivity demo program

trace1.png

2-2) Debug-trace: Step-Into XMPPTCPConnectionConfiguration.builder()

trace2.png

2-3) Debug-trace: Step-Into ConnectionConfiguration => SmackConfiguration.getVersion()

trace3.png

2-4) Step-over => ZygoteInit ???) => The demo program is destroyed

Thanks & Regards,

. I have copied the source code from the Maven Central Repository and used source code instead of jar files.
Why didn’t you simply configure Smack as dependency?

I wanted to debug trace the smack source code because the program hangs and I don’t know the cause of the problem.

The result will be the same (exception) even though I goes back again to configure Smack as dependency.

Even though I have changed to the source code, the Android Studio IDE doesn’t detect the exact location of the error.

Only finally ZygoteInit ???. I don’t know why.

My advice is not not use Android Studio if you want to debug 3rd party libraries which come with source attachments until Issue 59220 - android - Automatic source attachment for gradle dependencies - Android Open Source Project - Issue Tra… is fixed. Which, judging how Google has handled the bug in the past, will take something like at least 1 years until it’s supported.

Use Eclipse with Android ADT and my MavenToAndroidAnt script to create Android projects using libraries with source attachments. That’s how I develop my Android Apps that use Smack (and other FOSS libraries), as this setup allows me to debug the code, including the source of the libraries where the source is available.

Thanks for the tips.

I will try with those : Android ADT + MavenToAndroidAnt script.

I will close this discussion because there was no error in smack 4.2.0-alpha1.

The problem happened because I have commented out the following line because of compile error.

I have enabled it again.

//builder.setServiceName(mServiceName);

For source tracing, I will follow your guide. (Android ADT + MavenToAndroidAnt script)

And finally I have a question. Can you guide how to debug not-authorized (MD5) problem ?

[Situation]

  1. Now I can connect & login to the open fire server only with PLAIN Mechanism. (Smack 4.1.0 + Android 4.4 SmartPhone)

    (I have disabled DIGEST-MD5 Mechanism). //SASLAuthentication.blacklistSASLMechanism(“DIGEST-MD5”);

  2. If I remove DIGEST-MD5 from blacklist, login fails with the following logs.

D/SMACK﹕ SENT (0): =

D/SMACK﹕ RECV (0): cmVhbG09ImJsdWVza3ktc3I3MHMiLG5vbmNlPS IvbUpHbDVZZUZ4R3BPSC9jT3JlbWl2bmZpV3R2SmxJSktLNHFTOHN5Iixxb3A9ImF1dGgiLGNoYXJ

zZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz

D/SMACK﹕ SENT (0): dXNlcm5hbWU9InNoaW1oczEiLHJlYWxtPSIxOT IuMTY4LjIxOS4xOTMiLG5vbmNlPSIvbUpHbDVZZUZ4R3BPSC9jT3JlbWl2bmZpV3R2SmxJSktLNHFTO

HN5Iixjbm9uY2U9Ijc5clF2UVVKRm1pNmdZY3ZHMHNZODFhaENxV2tuUTZWIixuYz0wMDAwMDAwMSxx b3A9YXV0aCxkaWdlc3QtdXJpPSJ4bXBwLzE5Mi4xNjguMjE5LjE5MyIscmVzcG9uc2U9ZGU3MjA2OWQz Y2Q0Mjg3NDE3MWJiZjk

3MDkyNGI2YTAsY2hhcnNldD11dGYtOA==

D/SMACK﹕ RECV (0):

  1. sample code

XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder();

builder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);

builder.setHost(mServiceName);

builder.setResource(“Phone”);

builder.setPort(5222);

builder.setUsernameAndPassword(mUsername, mPassword);

builder.setDebuggerEnabled(true);

builder.setServiceName(mServiceName);

mConnection = new XMPPTCPConnection(builder.build());

mConnection.connect();

mConnection.login();

Can you guide how to debug not-authorized (MD5) problem ?
Those are a bit complex to debug. Starting to debug on the server side, e.g. which condition exactly triggers the not-authorized, is sometimes the best approach. Also those are often caused by a mismatch of the configured XMPP domain/service name between client and server.

Thanks,

I will close this discussion.