Unable to connect XMPP server with ASmack in Android <p>I have a fully working Chat Client that I made in Java. Now I'm looking forward to implement the same on my android device. I started off with importing the ASmack Library in my project and I'm checking at each phase to avoid errors. I'm stuck at the very first step though. My Activity is not able to find the class in ASmack Jar, hence I assume I'm unable to proceed. </p> <p><strong>My Simple code :</strong></p> <pre><code>package com.test.mypro; import org.jivesoftware.smack.ConnectionConfiguration; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class TestProjectActivity extends Activity { private static final String LOG_TAG = "TESTER"; /** Called when the activity is first created. */ TextView tvHello; XMPPConnection connection; ConnectionConfiguration config; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tvHello = (TextView) findViewById(R.id.tvHello); Log.i(LOG_TAG, "I'm here"); config = new ConnectionConfiguration("prc.p1.im", 5222, "prc.p1.im"); connection = new XMPPConnection(config); try { connection.connect(); // tvHello.setText("Connected to XMPP server"); Log.i(LOG_TAG, "Successfully Connected"); } catch (XMPPException e) { // TODO Auto-generated catch block e.printStackTrace(); Log.e(LOG_TAG, "Not Connected"); } } } </code></pre> <p><strong>LogCat Logs:</strong></p> <pre><code>12-22 15:58:16.319: E/dalvikvm(828): Could not find class 'org.jivesoftware.smack.ConnectionConfiguration', referenced from method com.test.mypro.TestProjectActivity.onCreate 12-22 15:58:16.339: W/dalvikvm(828): VFY: unable to resolve new-instance 26 (Lorg/jivesoftware/smack/ConnectionConfiguration;) in Lcom/test/mypro/TestProjectActivity; 12-22 15:58:16.339: D/dalvikvm(828): VFY: replacing opcode 0x22 at 0x0019 12-22 15:58:16.351: D/dalvikvm(828): VFY: dead code 0x001b-0047 in Lcom/test/mypro/TestProjectActivity;.onCreate (Landroid/os/Bundle;)V 12-22 15:58:16.509: I/TESTER(828): I'm here 12-22 15:58:16.519: D/AndroidRuntime(828): Shutting down VM 12-22 15:58:16.519: W/dalvikvm(828): threadid=1: thread exiting with uncaught exception (group=0x40015560) 12-22 15:58:16.561: E/AndroidRuntime(828): FATAL EXCEPTION: main 12-22 15:58:16.561: E/AndroidRuntime(828): java.lang.NoClassDefFoundError: org.jivesoftware.smack.ConnectionConfiguration 12-22 15:58:16.561: E/AndroidRuntime(828): at com.test.mypro.TestProjectActivity.onCreate(TestProjectActivity.java:24) 12-22 15:58:16.561: E/AndroidRuntime(828): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 12-22 15:58:16.561: E/AndroidRuntime(828): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 12-22 15:58:16.561: E/AndroidRuntime(828): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 12-22 15:58:16.561: E/AndroidRuntime(828): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 12-22 15:58:16.561: E/AndroidRuntime(828): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 12-22 15:58:16.561: E/AndroidRuntime(828): at android.os.Handler.dispatchMessage(Handler.java:99) 12-22 15:58:16.561: E/AndroidRuntime(828): at android.os.Looper.loop(Looper.java:123) 12-22 15:58:16.561: E/AndroidRuntime(828): at android.app.ActivityThread.main(ActivityThread.java:3683) 12-22 15:58:16.561: E/AndroidRuntime(828): at java.lang.reflect.Method.invokeNative(Native Method) 12-22 15:58:16.561: E/AndroidRuntime(828): at java.lang.reflect.Method.invoke(Method.java:507) 12-22 15:58:16.561: E/AndroidRuntime(828): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 12-22 15:58:16.561: E/AndroidRuntime(828): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 12-22 15:58:16.561: E/AndroidRuntime(828): at dalvik.system.NativeStart.main(Native Method) </code></pre> <p><strong>Additional Info :</strong> I have asmack-android-7.jar library imported. My AVD is running 2.3.3 Android.</p> <p>I assume owing to this I'm getting the fatal exception. What am I missing here? Your help would be appreciated. Thank you.</p>