Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4024028
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:40:16+00:00 2026-05-20T10:40:16+00:00

I am trying to make aSmack work in my project. Created a standard project

  • 0

I am trying to make aSmack work in my project.
Created a standard project in eclipse, added the jar to build path / libraries. Started using the XMPP classes, but I am not sure if there’s something else I should do to properly set up the project (later on that), since it’s not working.
In a Service, I start an AsnycTask to connect to google talk and send one chat message.

conn1 = new XMPPConnection(config);
// connecting to the server
try {
    conn1.connect();
    Log.v(LOG_TAG, "XMPP connected");
} catch (XMPPException xe) {
    msg = "XMPPException during connect(): " + xe.getMessage();
    Log.v(LOG_TAG, msg);
}

// login
try {
    conn1.login(USERNAME, PASSWORD, RESOURCE);
    msg = "login ok";
    Log.v(LOG_TAG, msg);
} catch (XMPPException xe) {
    msg = "XMPPException login(): " + xe.getMessage();
    Log.v(LOG_TAG, msg);

    StackTraceElement[] st = xe.getStackTrace();
    for (int i = 0; i<st.length; i++) { 
        msg = xe.getStackTrace()[i].toString();
        Log.v(LOG_TAG, msg);
    }
}

// creating a chat and sending messages
try {
     ChatManager chatmanager = conn1.getChatManager();
     msg = "creating chat";
     Log.v(LOG_TAG, msg);
     Chat chat = chatmanager.createChat(BUDDY_ADDRESS, new MessageListener() {

        @Override
        public void processMessage(Chat chat, Message message) {
            String msg = "incoming chat: " + message;
            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG);
            Log.v(LOG_TAG, msg);
        }
    });
    chat.sendMessage("ahoj");
} catch (XMPPException xe) {
    msg = "XMPPException during connect(): " + xe.getMessage();
    Log.v(LOG_TAG, msg);
}

(Please overlook my stupid exception handling, I’m still learning it 🙂
The connect() method should work, since it doesn’t throw an exception, in the Logcat howewer, before the “XMPP connected” message, there’s an error, and then an exception thrown by the login() method:

03-01 15:13:19.970: WARN/System.err(4465): stream:error (text)
03-01 15:13:19.970: WARN/System.err(4465):     at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:261)
03-01 15:13:19.970: WARN/System.err(4465):     at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
03-01 15:13:19.975: WARN/System.err(4465):     at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)
03-01 15:13:24.640: DEBUG/dalvikvm(3089): GC_EXPLICIT freed 610 objects / 39760 bytes in 216ms
03-01 15:13:26.370: DEBUG/NetworkLocationProvider(2020): onDataConnectionStateChanged 3
03-01 15:13:26.380: DEBUG/MobileDataStateTracker(2020): replacing old mInterfaceName (pdp0) with pdp0 for hipri
03-01 15:13:26.395: DEBUG/MobileDataStateTracker(2020): replacing old mInterfaceName (pdp0) with pdp0 for supl
03-01 15:13:26.400: DEBUG/MobileDataStateTracker(2020): default Received state= CONNECTED, old= CONNECTED, reason= (unspecified), apnTypeList= default,supl
03-01 15:13:31.570: DEBUG/dalvikvm(2806): GC_EXPLICIT freed 173 objects / 10752 bytes in 207ms
03-01 15:13:34.550: VERBOSE/Smacktest_01(4465): XMPP connected
03-01 15:13:36.600: DEBUG/dalvikvm(2583): GC_EXPLICIT freed 1551 objects / 87688 bytes in 236ms
03-01 15:13:39.580: VERBOSE/Smacktest_01(4465): XMPPException login(): No response from the server.
03-01 15:13:39.585: VERBOSE/Smacktest_01(4465): org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication.java:73)
03-01 15:13:39.605: VERBOSE/Smacktest_01(4465): org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:369)
03-01 15:13:39.605: VERBOSE/Smacktest_01(4465): org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:230)
03-01 15:13:39.620: VERBOSE/Smacktest_01(4465): com.biroalex.smacktest_01.SmackTest_01Service$AsyncXMPPConn.doInBackground(SmackTest_01Service.java:105)
03-01 15:13:39.620: VERBOSE/Smacktest_01(4465): com.biroalex.smacktest_01.SmackTest_01Service$AsyncXMPPConn.doInBackground(SmackTest_01Service.java:1)
03-01 15:13:39.635: VERBOSE/Smacktest_01(4465): android.os.AsyncTask$2.call(AsyncTask.java:185)
03-01 15:13:39.640: VERBOSE/Smacktest_01(4465): java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
03-01 15:13:39.655: VERBOSE/Smacktest_01(4465): java.util.concurrent.FutureTask.run(FutureTask.java:137)
03-01 15:13:39.655: VERBOSE/Smacktest_01(4465): java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
03-01 15:13:39.660: VERBOSE/Smacktest_01(4465): java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
03-01 15:13:39.665: VERBOSE/Smacktest_01(4465): java.lang.Thread.run(Thread.java:1096)
03-01 15:13:39.705: VERBOSE/Smacktest_01(4465): creating chat

So the question is 🙂 if I am doing something wrong, or the project is not prepared properly for the aSmack lib to be user on android?

There’s the aSmack author’s github https://github.com/rtreffer/asmack where he mentions that build environment, which is completely chinese for me. Shall I create a new build environment? How do I do that?

Thank you for your patience!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:40:17+00:00Added an answer on May 20, 2026 at 10:40 am

    It seems that my code works with an other open XMPP provider, so probably there’s no serious error neither in my code, nor in my build environment or whatever, and most probably not in the aSmack lib 🙂
    I’ll play around to find out what happens when trying to connect to google, but the question is invalid for now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make an Outlook 2003 add-in using Visual Studio 2008 on
Trying to make a make generic select control that I can dynamically add elements
Trying to make a MySQL-based application support MS SQL, I ran into the following
Trying to make a generic PL/SQL procedure to export data in specific XML format,
Trying to make a web service call to an HTTPS endpoint in my Silverlight
I'm trying to make the case for click-once and smart client development but my
I'm trying to make a data bound column invisible after data binding, because it
I'm trying to make a context menu for a control that is linked to
I am trying to make a div, that when you click it turns into
I am trying to make a JTable that has column spans available. Specifically, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.