Java Developer
Java Developer

Reputation: 133

java.lang.NoClassDefFoundError: org.jivesoftware.smack.XMPPConnection

I am trying to connect my android client to gmail server using asmack android jar but I am getting a runtime error NoClassDefFoundError on ConnectionConfiguration. I am using the following code

ConnectionConfiguration config = new ConnectionConfiguration("talk.google.com",5222,"gmail.com");
    XMPPConnection connection= new XMPPConnection(config);

Even I use only XMPPConnection connection= new XMPPConnection("gmail.com"); it still throws NoClassDefFoundError on XMPPConnection. asmack-android-5.jar file in the project. I have even tried to run this application using different smack jars but could not succeed. There is no build error but a runtime error and visible in eclipse DDMS. By da way I am using eclipse.

I have read the other thread but still not able to solve the problem.

Upvotes: 1

Views: 4131

Answers (2)

CodeDiving
CodeDiving

Reputation: 183

I do encounter the same problem. It takes lots of time to solve it. First, you may open the Java path build window. Then Choose the Order and Export tab. Make the asmack jar checked. Up the jar to the top.

Upvotes: 2

antew
antew

Reputation: 7478

Make sure you have a folder in your project called libs and that the smack jar is in there. Android will automatically load libraries from the libs folder. The jars will automatically appear under "Android Dependencies" in your Eclipse project after refreshing.

Upvotes: 5

Related Questions